0

I have a Database Structure for my chat application like this:

database structure

The member node contains the list of userid. I want to make a query with the userid and get the all the data wrt to the trash which contain that userid within its member node.

Say for example: If I query with userid "Ar9emr50ZRhWewpl7jKtJ9Bwr2s2", I should get all the data from trash with id "-KuLIYP8IQJTCz62o9UU" and "-KuLZatX9_gK_v81EhVJ".

I tried with indexing the member but it supports only to query for single element values not for the list of values.

shaud
  • 25
  • 6
  • 1
    You may need to create another node for users to store their trash ids . example : user_trash/{user_id}/trash/{trash_code} = 1 – agit Nov 02 '17 at 13:16
  • Thanks @agit for the reply. I understand that but my ideal goal using the queries here is to get the "chatname" and "group_prof_pic". By your method, I will get only trash ids but not the other details. – shaud Nov 02 '17 at 13:35
  • 1
    Actually after you get trash ids , you can use them get details for each trash . But I think, you already do not want to do such an extra query. – agit Nov 02 '17 at 14:34
  • 1
    @agit: I think you have all the parts of a great answer here. :-) If you think OP may worry about performance of loading the details, I always refer to http://stackoverflow.com/questions/35931526/speed-up-fetching-posts-for-my-social-network-app-by-using-query-instead-of-obse/35932786#35932786 – Frank van Puffelen Nov 02 '17 at 15:00
  • Hey @FrankvanPuffelen, How can I load the data in a pipelined manner using Python library for Firebase? I am using this [link](https://github.com/ozgur/python-firebase) package. – shaud Nov 03 '17 at 02:09
  • Forgot to update, Got it done using Multiprocessing.Pool process of python over that Firebase Library – shaud Dec 09 '17 at 09:32

0 Answers0