Reputation: 467
Could you please help to filter below JSON using eventId
?
{
"-Kb2dYPV0yUXpD_1moc9": {
"eventId": 1,
"message": "sdfsdfsf",
"sentOn": 1485004202943
},
"-Kb2etFm1xHd8sSsESeK": {
"eventId": 1,
"message": "shdfhsf",
"sentOn": 1485004553847
},
"-Kb2etKON8nWVKS2R0sj": {
"eventId": 2,
"message": "shdfhsf",
"sentOn": 1485004553853
}
}
I'm using below URL,
https://xxxxxxxx.firebaseio.com/chats.json?orderBy="eventId"&equalTo=1
but getting constraint index field must be a json primitive
error.
I want to retrieve chat objects with respect to particular event ID. I referred to the REST API, there, it was explained with simple JSON.
Please help me.
Upvotes: 7
Views: 3332
Reputation: 205
I've run into the same error before using the firebase REST api, and it was because I didn't have quotes around the value in the equalTo clause (e.g. equalTo="1")
Upvotes: 18