如何通过电子邮件ID" subu@gmail.com"?
搜索数据firebase数据
{
"-K5swDCvGh-fWBC3rvzz": {
"email": "subu@gmail.com",
"facebook_id": "123456789",
"password": "111",
"source": "facebook",
"username": "subu"
},
"-K5sxFSS4NC8tRRCtN-t": {
"email": "subu_google@gmail.com",
"google_id": "987456321",
"password": "111",
"source": "google",
"username": "subu_google"
}
}
我的数据卷曲是
https://subu.firebaseio.com/users.json
我的firebase规则如下所示
{
"rules": {
"users": {
".indexOn": "email"
},
".read": true,
".write": true
}
}
答案 0 :(得分:2)
使用orderBy查询字符串参数
curl https://subu.firebaseio.com/users.json?orderBy="email"
如果您需要进一步限制,可以使用startAt
,endAt
或equalTo
。
下面的查询通过电子邮件检索用户:
https://subu.firebaseio.com/users.json?orderBy="email"&equalTo="subu@gmail.com"
Read the section on Filtering Data in the Firebase docs for more information.