0

I am new to Firebase. The following is my database's structure.

{
    "dvdStores": {
        "store1": {
            "movies": {
                "0": "Don't Look Up",
                "1": "Top Gun"
            }
        },

        "store2": {
            "movies": {
                "0": "Jungle Book",
                "1": "Taken"
            }
        },

        "store3": {
            "movies": {
                "0": "The Matrix",
                "1": "Home Alone"
            }
        },

        "store4": {
            "movies": {
                "0": "The Lion King"
            }
        }
    }
}

Can I get all the movies corresponding to multiple keys in a single query? I would e.g. want to get all the movies corresponding to keys store1 and store4. Can this be done in a single query?

Thanks in advance :)

yosemite
  • 107
  • 1
  • 7

1 Answers1

1

This is not possible. You must request them each individually. All queries for a node always get the entire node, including all of its nested children. Children cannot be selectively included or excluded.

It's worth noting also that there is not much overhead in making multiple requests. The data for each query is pipelined over a single socket connection, so as long as you keep that connected saturated with requests, you are not losing very much perceived performance.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441