我有数据设置是这样的:如何在Firebase中为动态密钥编写.indexOn?
Tasks:{
Group 1:{
pushid1:{
date: 18921949021,
title: "Do something"
},
pushid2:{
date: 18921949021,
title: "Do something else"
}
},
Group 2:{
pushid3:{
date: 18921949021,
title: "Do another thing"
}
}
}
我按日期引用它,所以我只得到了一定时间之后进行的任务。
var now = Date.now();
var taskRef = new Firebase(FB + "/tasks/" + thisGroup);
taskRef.orderByChild('date').startAt(now).on("child_added", function(snap){
console.log(snap.val());
});
这一切工作正常,为每个组我得到一个警告消息,说是这样的:
FIREBASE WARNING: Using an unspecified index. Consider adding ".indexOn": "date" at tasks/Group 1 to your security rules for better performance
我如何添加到我的安全规则?我无法为用户创建的每个组添加一个,是否有某种类型的通配符条目?
嗨马蒂。你有没有解决这个问题?或决定改变结构?谢谢 – jovanjovanovic
@jovanjovanovic弗兰克的答案为我工作。 –