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

189
Vistas
How to add obectID from on schema to another in mongoDB?

I'm working on a multivendor cake selling project. the situation is the user can customize their cakes. to store that in mongo I can do simple post method and add it to mongo schema but the user info(id,name,phone,address) should be there too. how can I store the user info in the customize cake schema?

code I wrote is below.

exports.addCustomCake=(req,res)=>{
customCakeModel({
    user_id:req.saved_user._id,
    order_By:req.saved_user.name,
    phone:req.saved_user.phone,
    address:req.saved_user.address
    weight:req.body.weight,
    flavour:req.body.flavour,
    shape:req.body.shape,
    layers:req.body.layers,
    sponge:req.body.sponge,
    cakeType:req.body.cakeType,
    creamLevel:req.body.creamLevel,
    fondantLevel:req.body.fondantLevel,
    fondantCreamLevel:req.body.fondantCreamLevel,
    paintCake:req.body.paintCake,
    fillings:req.body.fillings,
    effects:req.body.effects,
    writingOnCake:req.body.writingOnCake,
}).save((err,customCake)=>{
    if(!err){
        res.status(200).json({
            status:'success',
            result:customCake,
            message:'Custom cake added...'
        });
    }else{
        res.status(404).json({
            result:err,
            message:'Custom cake add failed.'
        })
    }
})

}

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