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

247
Visualizações
How not to delete the whole document in mongoose (express.js), but just only a string in an array

this is my first time on this platform and my english is bad so sorry if I don't understand all the intricacies of my problem.

I have question about: why does findOneAndDelete() in mongoose delete all document instead of deleting exat string of array.

Thats my mongoose document in my collection: thats document

what i need exatly is to remove the string[.1]-uk of array in my soketController (node.js/express.js/server) if thats string is the same with result value (its supposed to be same after convert). its server side i tried this or findOneAndDelete({name:result}) but is delete whole document or doesnt work at all ($pull).

Thanks in advance for your help

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

0

I found out my issue.

$pull works with something else like $in

so:

const final = await AllUrlDb.updateOne(isDetleteURL,{
                                       $pull: {
                                          name:{
                                            $in: [result]
                                          }
                                       }
                                    })
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