0

I made an example database at the bottom of this question.

In my Admin application I would like to be able to search directly for the status of the user.

If I do a search by Key I must go to the Users then the user-1 and finally This method is a big problem if I have several dozen or more users.

Does anyone have a method so that I can directly find user statuses and not go through children (which would be impossible)**

**If not, is there a search text where I can directly search for what I want ?

Obviously I want a method that displays all the wrong statuses or just the statuses.

Example

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

Firebase queries work on a flat list of child nodes, where the value you search for must be at a fixed path under each direct child node.

So in your data structure, you can search across all users for infos-1/statut with:

ref("users").orderByChild("infos-1/statut").equalTo(true)

Or you can search across all infos-* nodes for user-1 with:

ref("users/user-1").orderByChild("statut").equalTo(true)

You cannot however search across all users for all infos-* nodes.

For more on this, also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807