Firebase and select individual

My data in firebase looks like

enter image description here

Is it possible to make selection in a Genre node using the REST API for firebase?

0
source share
2 answers

When you read a tree in Firebase, you get all the children. There is no way around this.

However, you can create a data structure that contains only genres for the movie.

{
   "movieGenres": {
      "3646": {
        "0": "Comedy"
      },
      "3647": {
        "0": "Drama"
      },
      "3648": {
        "0": "Horror",
        "1": "Sci-Fi"
      }
   }
}

Now getting genres is easy reading.

+4
source

David's answer is correct (do you expect anything less?)

I wanted to outline my answer with a slightly more specific example:

Structure

movies
  movie_id_0
    name: "Star Trek: Beyond Thunderdome"
    genre: genre_id_0
  movie_id_1
    name: "Airplane: Part Trois"
    genre: genre_id_1
  movie_id_2
    name: "Star Wars: Episode 132"
    genre: genre_id_0
genres
  genre_id_0
    description: "Sci-Fi"
    verbose: "Science Fiction is the literature of change"
  genre_id_1
    description: "Comedy"
    verbose: "Comedy is entertainment consisting of jokes and satirical sketches"

, node, , , Sci-Fi Science Fiction, , , , . .

, , , Sci-Fi Comedy

, .

, !

+1

Source: https://habr.com/ru/post/1660259/


All Articles