I am triying remove field in a big document, therefore I would like to do something:
collection.update({'_id' => @id}, {"$unset" => {'herField'})
But it is not possible. I don't want to rewrite entire document, any idea?
EDIT: I am using https://github.com/mongodb/mongo-ruby-driver
Your syntax looks slightly incorrect. As per docs:
collection.update( { _id: @id }, { $unset: { herField: true } }, { multi: true });
Need the 'multi' option if you want to update multiple documents. E.g. from all records on this collection.
http://docs.mongodb.org/manual/reference/operator/unset/#op._S_unset