[SERVER-134] $unset (was: $unset and $rename) Created: 08/Jul/09  Updated: 12/Jul/16  Resolved: 11/Dec/09

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 1.3.0

Type: New Feature Priority: Major - P3
Reporter: Kristina Chodorow (Inactive) Assignee: Mathias Stearn
Resolution: Done Votes: 20
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-394 $rename updates Closed
Participants:

 Description   

Right now, you can only do a $set on an update. It would be helpful to be able to delete or rename a field as well.



 Comments   
Comment by auto [ 11/Dec/09 ]

Author:

{'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}

Message: $unset support in update. SERVER-134
http://github.com/mongodb/mongo/commit/cb16e7c62b094c81fd443b6f33f9b72b2f5a58f9

Comment by Mathias Stearn [ 28/Oct/09 ]

Splitting to two issues. If you want $reduce, watch or vote for http://jira.mongodb.org/browse/SERVER-394

Comment by Wouter [ 01/Sep/09 ]

Please make $unset compatible with arrays aswell, so that I can unset a value in an array based on it's key:

$unset :

{ 'comments.5' : TRUE }
Comment by Wouter [ 08/Jul/09 ]

I would like $unset/$rename too.

Let's say we have

{ _id : 1, toberemoved : 'hello', dontremove : 'world' }

1) $db.foo.save(

{ _id : 1, dontremove : 'world' }

);
Could have concurrency issues.

2) $db.foo.update(

{ _id : 1, toberemoved : 'hello', dontremove : 'world' }

,

{ _id : 1, dontremove : 'world' }

);
Will fail if another process already changed the object.

3) $db.foo.update(

{ _id : 1 }

, { $unset :

{ toberemoved : 1 }

} );
This will never fail nor have any concurrency issues ideal behavior,

Generated at Thu Feb 08 02:53:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.