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

findAndModify + fields returns nothing but _id

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 1.8.2
    • None
    • None
    • ALL

    Description

      1) > db.test.find()

      { "_id" : ObjectId("4e04e3d79c57c1b8fe3830af"), "v" : 11 }

      2) > db.test.findAndModify({query: {}, update: {'$inc': {v: 1}}, new: true})

      { "_id" : ObjectId("4e04e3d79c57c1b8fe3830af"), "v" : 12 }

      3) > db.test.findAndModify({query: {}, update: {'$inc': {v: 1}}, new: true, fields: ['v']})

      { "_id" : ObjectId("4e04e3d79c57c1b8fe3830af") }

      Output of 3) should contain the 'v' field.

      Same thing with the Python driver; with new=False and with multiple fields.

      Attachments

        Activity

          People

            scotthernandez Scott Hernandez (Inactive)
            jonash Jonas H
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: