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

Empty update deletes a record

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.1
    • None
    • None
    • ALL
    • Hide

      Start with a record:

      { "_id" : ObjectId("53c7cf02449a3606a7037755"), "guid" : NumberLong("279172874564"), "region_id" : "US"}

      Call update on the collection (this example is in python)

      collection.update({'guid': 279172874564}, {}, safe=True, w=1, wtimeout=250)

      Observe that the record has now been cleared.

      { "_id" : ObjectId("53c7cf02449a3606a7037755") }

      The expected behavior is that this is treated as a no-op.

      Show
      Start with a record: { "_id" : ObjectId("53c7cf02449a3606a7037755"), "guid" : NumberLong("279172874564"), "region_id" : "US"} Call update on the collection (this example is in python) collection.update({'guid': 279172874564}, {}, safe=True, w=1, wtimeout=250) Observe that the record has now been cleared. { "_id" : ObjectId("53c7cf02449a3606a7037755") } The expected behavior is that this is treated as a no-op.

    Description

      mongo 2.6.1
      pymongo 2.5.1

      Calling Collection.update with an empty dictionary will delete all but the _id field.

      Attachments

        Activity

          People

            Unassigned Unassigned
            aaron.westendorf Aaron Westendorf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: