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

193
Visualizações
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 à 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