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

Blank key in embedded doc seems to prevent findAndModify from applying modifier

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.4
    • 2.0.7, 2.2.0
    • Write Ops
    • None
    • ALL

    Description

      Reproduce with this (ops must be applied in order):

       
      db.test.insert({'name': 'TEST'})
      db.test.findAndModify({query:{'name': 'TEST'}, update:{'$inc': {'counters.test.one': 1}}, new:true})
      db.test.findAndModify({query:{'name': 'TEST'}, update:{'$inc': {'counters.test..foo': 1}}, new:true})
      db.test.findAndModify({query:{'name': 'TEST'}, update:{'$inc': {'counters.test.two': 1}}, new:true})

      The second findAndModify statement creates an embedded doc under a blank key ("").
      The subsequent call to findAndModify in the last line, even when executed multiple times, never seems to actually increment the counter.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mikeo@mongodb.com Michael O'Brien
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: