• Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.0
    • Affects Version/s: 3.0.7
    • Component/s: Native

      Hello,

       
      The methode findOneAndUpdate with a empty update field $unset all the field. :
       
      collection.findOneAndUpdate({ _id: new ObjectID(id) }, {}, { upsert: false })
       
      I know that if empty i should prefer use only the findOne method but it seems dangerous to unset all if empty in this method. and i need to use it like this. Expect to do nothing if empty.
       
       
      Dor now i make the trick to protect against the $unset all with : 
      collection.findOneAndUpdate({ _id: new ObjectID(channelId) }, { $setOnInsert:

      { insert: true }

      }, { upsert: false })
       
      Can you update this rules?
       
       

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            ohrrkan ohrrkan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: