0

For example, I have this tree:

enter image description here

How to use query to get for example just the "meeting_1" by the user?

I tried this code (The names just for this example):

        final DatabaseReference mDatabase =  getDatabaseReference(ConstantNames.MEETINGS_PATH).child ( TeamID );
    Query query = mDatabase.orderByChild("PublicTo").equalTo("User_1");

This code not working. The value of DataSnapshot is "null"

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
ofek gani
  • 33
  • 5
  • The data structure you have makes it easy to find all users for a specific meeting. It does not however make it easy to find all meetings for a specific user. To allow that you'll need to add a similar-but-inverted data structure that maps from a user ID to their list of meetings. For more on this see: https://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value – Frank van Puffelen Feb 09 '21 at 15:07

1 Answers1

0

If you only want to access meeting 1 then you can only access that child which is meeting 1

FirebaseDatabase database = FirebaseDatabase.getInstance();
databaseReference = database.getReference("CupShupRooftop/Promos");

For example in the above code i am accessing promos which is child of cupshuprooftop So in your case you can do

  db.getrefence("team id"/"meeting 1")
Saeed All Gharaee
  • 1,546
  • 1
  • 14
  • 27
Bobo
  • 7
  • 2
  • My goal is to eventually get all published meetings to same user. That is, to filter out from the data the meetings that are not intended for that user. – ofek gani Feb 09 '21 at 14:19