根据Tom对this问题的回答,我在尝试查询集合上的嵌套字段时收到以下错误。
我尝试使用personalityExams.id.extId = 24232来获取单个用户对象。我想知道查询此问题的最佳方法,以及如何为其构建索引规则。< / p>
以下是用户在firebase中的样子
{
"users": {
"93306b91-d5ba-4e06-838c-0ab85fd58783": {
"createdOn" : 1451495976870,
"email" : "iyad.bitar@gmail.com",
"firstName" : "Iyad",
"lastModifiedOn" : 1451590413654,
"lastName" : "Bitar",
"mobile" : "34234333",
"provider" : "password",
"userType" : "JS",
"personalityExams": [
{
"extId": "24232",
"skills": ["teaching"]
}
]
}
在我的javascript中,我试图这样做:
(new Firebase("https://hirely-dev.firebaseio.com/users")).orderByValue("personalityExams/extId").equalTo("24232").on("value", function(snapshot) {user1 = snapshot.val();});
错误:
Uncaught Error: Query.orderByValue failed: Was called with 1 argument. Expects none.
at Error (native)
at x (http://localhost:7200/lib/firebase/firebase.js:20:1074)
at U.g.Fg (http://localhost:7200/lib/firebase/firebase.js:233:343)
at <anonymous>:2:59
at Object.InjectedScript._evaluateOn (<anonymous>:875:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34)
at Object.InjectedScript.evaluate (<anonymous>:664:21)