0

I'm trying to make a cloud function that will search for a specific child in my database.

This is my database structure:

places
   place_id_1
      users
         user1
            date: 1231233
         user2
            date: 3213424
   place_id_2
       users
          user3
             date: 123442

And what i'm trying to do is search to what node 'user1' is connected ('place_id_1' is this case).

It might have a lot of children under 'places' node, so it wont be a good idea to go over all of them (and it can take a lot of time..)

Is there a way to easily query and get all the nodes that are associated with a specific user?

1 Answers1

0

Firebase only allow you to query at 1 level. You will need to create a reference table. Eg:

usersReference:   
  user1: 
   place_01
  user2: 
   place_02

Please have a look here: Firebase Query Double Nested

ian1095
  • 551
  • 4
  • 8