Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Eliminar elemento en matriz por su índice - mangosta

Tengo un modelo de mangosta que se ve así:

 Member: { memberId: { type: String, required: true }, customPlaylists: { type: Array, default: [] } }

La matriz de customPlaylist contiene objetos que se ven así:

 { name: 'playlist name', urls: [] } // urls array contains url strings

¿Hay alguna manera de usar el método updateOne de mongoose para eliminar una URL de la matriz de URL por su índice en la matriz? (Uso la identificación del miembro en el objeto de filtro)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No estoy seguro de si hay una forma directa (1 consulta) de hacer esto. Pero puedes probar esto

 <collectionName>.update({}, {$unset : {"urls.<indexNumberHere>" : 1 }}) <collectionName>.update({}, {$pull : {"urls" : null}})

Hubo un ticket para implementar esta función y la resolución fue Won't Do

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!