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

105
Views
Why updateMany didnt mongoose

I cannot solve this problem. Other words updateMany and updateOne cannot work :

router.post('/deleteChat', async (req, res) => {
    if(!req.isAuthenticated()) return res.status(400).json({message: "User cant loginned"});
    
    const {currentConversation} = req.body;

    try {
        await Messages.updateMany({ $and: [ {about: currentConversation._id}, {who_delete: { $nin: [req.user._id] } } ] }, {$push: {who_delete: req.user._id} } )
        await Conversation.updateOne( {$and: [ {_id: currentConversation._id}, {status: {$nin: [req.user._id] } } ] }, {$push: {status: req.user._id }} )
        return res.json()
    } catch (error) {
        return res.status(500).json({message: "Something wrong went!"})
    }
    
});

I want to say if user cannot inside array then add insert array. But I cannot do this? What I need use $ne or $nin?

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