0

I have this structure in my Firebase database structure

How I can get "ch1" knowing one of uids? ("uid1"/"uid2") I tried this: FirebaseDatabase.getInstance().getReference().child("messages").orderByChild("users").startAt("users",partnerId), but it gave me all chats.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Ekalips
  • 1,473
  • 11
  • 20
  • Do you want to simply access a known chapter? If so: attach your listener to `FirebaseDatabase.getInstance().getReference("messages/ch1")`. – Frank van Puffelen Apr 14 '17 at 16:06
  • @FrankvanPuffelen , no, I want to find this "ch1". There can be any of "ch$" containing some "uid$" –  Ekalips Apr 14 '17 at 16:10
  • Ah.. that's a categorization problem. If you want to be able to get all chapter for a specific user, you should model precisely that: keep a list of the chapters for each user. See http://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value – Frank van Puffelen Apr 14 '17 at 18:27

0 Answers0