chrishinds / committed

nodejs package providing a framework for failure-resistant transaction and audit support atop mongodb-native and async.queue
GNU General Public License v3.0
7 stars 1 forks source link

updateOneDoc insufficiently brutal with objects #4

Closed simon-bond closed 9 years ago

simon-bond commented 9 years ago

If I have a document thus:

{
  foo: {
    bar: "baz"
  }
}

and delete foo, updateOneDoc will create a mongo ops which $unset: {"foo.bar": 1} leaving me with a document that looks like

{
  foo: {}
}

Conversely, if I attempt to set foo to null, updateOneDoc will create mongo ops which attempt to $set: {foo: null} and $unset: {"foo.bar": 1} resulting in a have conflicting mods in update error from Mongo.