Super simple one I am sure, but I'm new to Firebase it's stumping me. I have a JSON tree as follows in Firebase:
{
"games" : {
"-LKZxsIcVe3Uixrdxdau" : {
"id" : "thing1",
"name" : "This is a thing"
},
"-LKZxt57WpCd8ARMr1Cy" : {
"id" : "thing2",
"name" : "This is another thing"
},
"-LKZxtm8udMhEyZ3tHd5" : {
"id" : "thing3",
"name" : "And yet another thing"
}
}
}
I know that I can get an object by firebase ID with:
this.theThing = this.db.object('/games/-LKZxtm8udMhEyZ3tHd5').valueChanges();
How do I get a single object on id though please?
I've seen how to query lists using equalTo. Is that the way to do it? If so, how do I return a single object and assign it to my this.theThing variable as above so that it also gets updated in realtime etc?
Further, is it efficient to query in this way, or should I actually be querying by Firebase ID?