خرید بک لینک

Vote count: 0

Firebase Structure

Let's say I have a list of posts with author and language

posts   
   |-ID1
     |--text: "bla bla"
     |--author: "Mario"
     |--lang: "it"
   |-ID2
     |--text: "bla bla"
     |--author: "Mario"
     |--lang: "en"
   |-ID3
     |--text: "bla bla"
     |--author: "Tom"
     |--lang: "en"

I would like to have flexibility on reading data by author and by language... but In Firebase I caot combine both (to have the posts from Mario written only in englis)

getReference("posts").orderByChild("author").equalTo("Mario").orderByChild("lang").equalTo("en")

the exception is

 java.lang.IllegalArgumentException: You can't combine multiple orderBy calls!
           at com.google.firebase.database.Query.zzPm(Unknown Source)
           at com.google.firebase.database.Query.orderByChild(Unknown Source)

Are we oblidged to flatten the data structure for every search criteria we would like to use as filter?

In this case I will have a DB structure containing posts, one containing post organized by author, one organized by language...

asked 29 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 15 مرداد 1395 ساعت: 17:23

صفحه بندی