Created
December 29, 2011 08:49
-
-
Save lexer/1533021 to your computer and use it in GitHub Desktop.
How to remove deprecated fields in mongo?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.collection.find().forEach(function(x) { | |
delete x.badField; | |
db.collection.save(x); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.collection.update( { field: { $exists: true } }, {$unset: { field : 1 } }, false, true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment