Firebase配置警告消息.indexOn

时间:2017-10-06 09:49:43

标签: javascript reactjs firebase firebase-realtime-database

考虑以下firebase.rules.json:

{
  "rules": {
    ".read": "auth != null",
    ".write": "true",
    "users": {
      ".indexOn": "email"
    }
  }
}

为什么我仍然在chrome devtools上发出此警告?

FIREBASE WARNING: Using an unspecified index. 
Consider adding ".indexOn": "email" at /users 
to your security rules for better performance 

我也试过(没有成功):

{
  "rules": {
    ".read": "auth != null",
    ".write": "true",
    ".indexOn": "email"
  }
}

以下是抛出错误的查询:

firebase.database().ref('/users').orderByChild("email").equalTo(userEmail).once('value').then(function(snapshot) {
      if (snapshot.val() !== null) { 
         #do smth 
      } else { 
         #do smth 
      };
    };

我应该如何更改配置才能解决此问题?

任何输入都非常感谢

0 个答案:

没有答案