Possible Duplicate:
In MongoDB, How to toggle a boolean field in one document with atomic operation?
I need to update a document value, "toggling" it:
The collection is "Comment" which has boolean flag "isAdmin".
I'm going to update a given comment id, setting isAdmin false if it's true and viceversa.
However this does not work:
db.comments.update( { "id": "xxx" }, { $set: { isAdmin: $not isAdmin } } );
What's the right syntax?