ios - FIrebase 3 query to return value that matches child key/value -
i've upgraded ios application use firebase 3 , query working in firebase 2 no longer works in firebase 3.
the old query written follow.
firebaseuser.queryorderedbychild("displayname").queryequaltovalue(frienddisplayname)       .observesingleeventoftype(.value, withblock: { snapshot in } where frienddisplayname have been 'someguy1' , have returned object someguy1 part of.
now however, same query returns nothing on firebase 3. feeling because firebase 3 isn't looking inside child objects themselves, it's looking displayname actual child itself. if update query example returns expected.
    database.child("0hftq3cttfwnfvg0dmea1raypow2").queryequaltovalue("someguy1", childkey: "displayname").observesingleeventoftype(.value, withblock: { snapshot in } but won't work solution me because don't want have parse through child nodes , search through them etc.. way see 1 solution if firebase had 'catch all' specify child like
database.child(*****).etc where **** can value, doesn't need specified in actual query.
does know how resolve issue? i've attached firebase json layout below.
thanks!
 {       "users" : {         "0hftq3cttfwnfvg0dmea1raypow2" : {           "displayname" : "someguy1",           "pushoptions" : 1,           "pushtoggle" : false         },         "9batnlbnnoxmovk4lhtqfmngjjy1" : {           "displayname" : "someguy2",           "pushoptions" : 0,           "pushtoggle" : true         }       }     } 
i found out despite there being no documentation on it, displayname acts keyword - user object provided firebase offers displayname property, unlike other databases, can't use displayname in other nodes or children - can, it's not searchable. in end changing displayname property username solved problems.
hope helps else.
Comments
Post a Comment