Reputation: 1115
my data look like
{
"word0" : {
"level" : "B2",
"meaning" : [ "Meaning19", "meaning43" ],
"type" : "Noun",
"weight" : 0,
"word" : "word99"
},
"word1" : {
"level" : "C1",
"meaning" : [ "Meaning19", "meaning43" ],
"type" : "Noun",
"weight" : 0,
"word" : "word99"
},
"word10" : {
"level" : "A2",
"meaning" : [ "Meaning19", "meaning43" ],
"type" : "Noun",
"weight" : 0,
"word" : "word99"
}
}
i am using curl get request https://words-b6651.firebaseio.com/DE-EN.json?orderBy="$key"&print=pretty
and i want to get all words of a given level
is it possible to do something like $key."level" as in MongoDB ? and how could i get these data
Upvotes: 3
Views: 4814
Reputation: 599591
You can order by a property using:
https://words-b6651.firebaseio.com/DE-EN.json?orderBy="level"&print=pretty
Two notes:
".indexOn": "level"
the items in the JSON will be in an undetermined order, since JSON is inherently non-ordered. This means that ordering in the REST API is really only useful when you also filter the data, e.g.
https://words-b6651.firebaseio.com/DE-EN.json?orderBy="level"&equalTo="B2"&print=pretty
Upvotes: 7
Reputation: 161
Yes, sending curl to your word's key path will return all of the values.
https://words-b6651.firebaseio.com/my/path/word10.json?&print=pretty
Upvotes: 0