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

Excluding _id field doesn't work with FindAndModify

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.1
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • Environment:
      Windows 7 64
    • ALL

      If I have the following document:

      db.sequence.findAndModify({
      query:

      {"_id": "customer"}

      ,
      update : {$inc : {"seq":1}},
      fields:

      {"_id":0}

      ,
      upsert:true,
      new:true})

      Notice the fields:

      {"_id":0}

      , part-
      According to the documentation, this should prevent the id from being returned, however when I try and execute this command, I get this error:

      Uncaught exception: findAndModifyFailed failed: "exception: assertion c:\\builds\laves\\mongo\\windows_64bit_v1.6\\mongo\\db
      ../bson/bsonbjbuilder.h:115"

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            alexjamesbrown Alex Brown
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: