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

143
Visualizações
how to keep account of which user has posted which record in mongoDB database

I am working on MERN project, where users can post ads of their vehicles and other user can see these ads. I want that only the use who has submitted a vehicle ad will be allowed two delete that specific ad.I have to different mongoDB schema for user and vehicles ad and successfully storing and fetching users and vehicle data from mongoDB.I have no idea how this can be done. Can some guide me how it can be possible?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You would add an identifier to your Vehicles collection to know which User is the owner of the Vehicle

{
  "_id": "12345",
  "description": "Vehicle for sell",
  "userId": "Your user _id goes here or any other unique identifier for user"
}

and then upon request to Update / Delete an ad you check whether requesting user has same id as userId in Vehicles collection.h

about 4 years ago · Juan Pablo Isaza Relatório
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