> db.bobo.save(
{a:1, b:2, c:3, d:4}
)
> db.bobo.find()
{ "_id" : ObjectId("5100b05af1c2c68819360d1a"), "a" : 1, "b" : 2, "c" : 3, "d" : 4 }
> db.bobo.update(
{a:1, b:2}
, {$unset:{c:1, d:1}})
> db.getLastErrorCmd()
{
"n" : 0, // <------- it expected to be `1`
"lastOp" :
{
"t" : 1358999706000,
"i" : 1
}
,
"connectionId" : 131,
"err" : null,
"ok" : 1
}
> db.bobo.find(
{a:1, b:2}
)
{ "_id" : ObjectId("5100b05af1c2c68819360d1a"), "a" : 1, "b" : 2 }
> db.bobo.update(
{a:1}
, {$unset:{b:1}})
> db.getLastErrorCmd()
{
"updatedExisting" : true,
"n" : 1,
"lastOp" :
{
"t" : 1358999741000,
"i" : 2
}
,
"connectionId" : 131,
"err" : null,
"ok" : 1
}