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

251
Views
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 answers
Answer question

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 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!