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

findAndModify + fields returns nothing but _id

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 1.8.2
    • Component/s: None
    • None
    • ALL

      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.

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

              Created:
              Updated:
              Resolved: