Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
Relational data in Firestore + Node.js

I'm trying to create a recipe backend to test firestore and so far I've managed to get the CRUD operations working for the users, authentication & hashing passwords. Now I wanted to make it so there are two tables: ingredients and recipes and was wondering the best way to go about this?

My plan:

  1. Make ingredients with all the apples, pears, rice, etc. and fill up the table as usual.
  2. Make recipes with an ingredients array that just points to the ingredientId of each of the ingredients. (one to many)
  3. Make it so the users can place a single review on the recipe (one to many)

I've done something similar in MongoDb before but I can't find anything written about firestore + Node.js on this. For reference, in MongoDb I would do something like this for the `reviews:

  review: {
    type: mongoose.Schema.ObjectId,
    ref: 'Recipe',
    required: [true, 'Review must belong to a Recipe!']
  },

My idea is that I structure it like:

Recipe: {
   name: 'Yummy Cake',
   cooking time: '15 mins',
   ... other fields,
   ingredients: [
       { ingredientId1: '5',
         ingredientId2: '25',
         ...
       }
     ],
   reviews: [
      { userId1: '4',
        userId2: '3',
      }
    ]
  }
      

But I don't really know how to write that in a firestore-friendly manner. Any help is greatly appreciated! Also I'm using firebase-admin as the package.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda