"how to query firebase database object when criteria property is nested?" Code Answer

5

one way to approach this is to save the reference to the posts on the user. like this:

root
 - users
   - [userid]
      - userposts
        -k_54s1smpph6qn4znut
 - posts
   - -k_54s1smpph6qn4znut
     - key1: val
     - key2: val
     - user:
       - -k_54ssomekeyfromusersobject: "john doe"
...

so when you want to retrieve all posts by an user, you just look at the references on the user profile

By Judge Bread on June 19 2022

Answers related to “how to query firebase database object when criteria property is nested?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.