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

Empty update deletes a record

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.1
    • Component/s: None
    • Labels:
      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.

      mongo 2.6.1
      pymongo 2.5.1

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

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

              Created:
              Updated:
              Resolved: