Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6226

findAndModify return value inconsistent between 2.0.x and 2.1.2 when using upsert

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.2.0-rc0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL

      Description

      Found this while testing PyMongo against 2.1.2. In 2.0.x mongod returns {'ok': 1.0, 'value': {}}, in 2.1.2 it returns

      {'ok': 1.0, 'value': null}

      .

      MongoDB shell version: 2.0.6
      connecting to: test
      > db.test.findAndModify({query: {'_id': 1}, update: {'$inc': {'i': 1}}, upsert: true})
      { }
       
      MongoDB shell version: 2.1.2
      connecting to: test
      > db.test.findAndModify({query: {'_id': 1}, update: {'$inc': {'i': 1}}, upsert: true})
      null

      This will cause problems for code that expects a document as return value.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: