Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda