Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda