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

173
Visualizações
Nodejs Send json data and images together to a route and store them in mongodb

I am trying to retrieve image file and json file together from a route and save all those information in MongoDB.

const petCheckoutDetails = new PetCheckoutDetails({
    id: Date.now(),
    name: req.body.name,
    age: req.body.age,
    image: imagefile,
    petType: req.query.petType,
    user: userid,
  })

I can get the json from req.body and store it in database but for image I cannot just save it with multer simultaneously. So I tried creating a route for image /upload. Now I can save image and json separately. I want to save in the given upper format. Is there a way I can do it or just save the image there and somehow point that this image belongs to specific user. Any help will be appreciated.

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