0

I'm using Angular 6 anf AngularFire2.

enter image description here

So, the task is to get all Collections where publish:true.

and the path to that Collection in my case is v4/users/<userKey>/collections/<collectionKey>/

Now, my question is, is it possible to get all of publish:true collection with one query?

Or do I have to make multiple queries in this case? Like:

  1. get all users
  2. for every user get all collections where publish:true
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Ivan
  • 852
  • 1
  • 12
  • 29
  • 2
    Firebase Database can order/filter results based on a value that's at a known path under the children of the nodes that are queried. There is no way to query all users based on a property in one of their collections. See https://stackoverflow.com/questions/27207059/firebase-query-double-nested. As usual the solution is to add a data structure that allows your query. The simplest would be to add a top-level list of published collection IDs. – Frank van Puffelen Jun 12 '18 at 18:58
  • 1
    The other way is make your data redundant, for example keep all data under `published` collection as well, so when you can query easily – Reza Jun 12 '18 at 19:33

0 Answers0