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

188
Visualizações
How to add watchlist/wishlist item to mongoDb using nodejs and react js?

I Am trying to learn full-stack development using the MERN approach. I have a situation where when a user adds the item to its watchlist, which has the following filed

movie id
movie poster(an image)
movie name 
released date 

I want to store this to MongoDB Atlast using mongoose query and node.js

and such that when a user clicks on remove button on front-end it gets deleted.

However I know I have to use get, post, put, patch, delete APIs respectively. But my concern is, how is this possible or can be achieved when you have image type in your schema?

In short, how can I store the data which has an image for example below card?

img

Thanks for your help and your advice. Please see the Schema code below which am trying please do correct me where am wrong also advice me on related tutorial,

//on watchlistSchema.js
import { express } from "express";
import { mongoose } from "mongoose";

const watchlistSchema = mongoose.Schema({
    name: {
        type: String,
    },
    image: {
        type: Buffer,
    },
});

const watchlistItem = mongoose.model("newWatchlist", newWatchlistSchema);
module.exports = watchlistItem;

//on route.js
const watchlistItem = require("../model/watchlistSchema");
router.post("/watchlistitem", (req, res) => {
    res.send("hi ");
    console.log("watchlist item is here");
});

Trying to test on POSTMAN

img2

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