¿Por qué este Firebase ".indexOn" no funciona?
Entonces tengo datos como este:
pushNotifications {
-K - RwEgd541PIGNOXXUH: {
message: "Xiaoyu Hugh Hou bid at $900 on your task: New P..."
notifyId: "facebook:10100683829966199"
relatedTask: "-Jzl8XKaxGCv19nIOChm"
timestamp: 1443594566599
} - K - RwpcBlQa04VJT4Bwm: {
message: "Sam Feldt bid at $1100 on your task: New Post g..."
notifyId: "google:1043268349966197"
relatedTask: "-Jzl8XKaxGCv19nIOChm"
timestamp: 1443594721963
} - K - RwuM3 - 0 G0q9I96WHg: {
message: "Sam Feldt bid at $600 on your task: NO Firebase..."
notifyId: "facebook:10100683829966199"
relatedTask: "-JzTSk2TIlO46oVqJ1Nn"
timestamp: 1443594741347
}
}
En mi código, necesito obtener la última notificación a continuación para un determinado "notifyId". Aquí está el código:
ref.child('pushNotifications')
.orderByChild("notifyId")
.limitToLast(1)
.on("child_added", function (snapshot) {
console.log("Found a new notification...");
sendPush(snapshot.val());
});
En mi regla de seguridad de Firebase, tengo esta regla de índice:
"pushNotifications": {
".read": "auth != null",
".write": "auth != null",
"$pushId": {
".indexOn": ["notifyId", "timestamp"],
}
},
Es la estructura de índice seguida por los documentos de Firebase aquí:docs
Pero cuando ejecuto el código, la consola sigue registrando
ADVERTENCIA SOBRE INCENDIO: Uso de un índice no especificado. Considere agregar ".indexOn": "notifyId" en / pushNotifications a sus reglas de seguridad para un mejor rendimiento
Lo cual no tiene ningún sentido ya que ya lo hice. ¡Por favor ayuda!