Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2945

ignoreUndefined not works on findOneAndUpdate when { upsert: true }

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.4
    • Affects Version/s: 3.6.3
    • Component/s: None
    • Labels:

      Code:

      // MongoClient.connect(uri, {  ignoreUndefined: true })
      
      db.collection('Test').findOneAndUpdate(
          {
              test: 'test'
          },
          {
              $set: {
                  undefined_1: undefined,
                  null_1: null,
              },
              $setOnInsert: {
                  undefined_2: undefined,
                  null_2: null,
              }
          },
          {
              upsert: true
          }
      )
      

       
      Expect document:

      {
        test: 'test',
        null_1: null,
        null_2: null
      }
      

      Actual document:

      {
        test: 'test',
        undefined_1: null,
        null_1: null,
        undefined_2: null,
        null_2: null
      }
      

       

            Assignee:
            eric.adum@mongodb.com Eric Adum (Inactive)
            Reporter:
            twoeo.vip@gmail.com King Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: