Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdbrian/5573398 to your computer and use it in GitHub Desktop.
Save tdbrian/5573398 to your computer and use it in GitHub Desktop.
Converts all MongoDB fields in a collection from number to string
db.portals.find( { 'pid' : { $type : 1 } } ).forEach( function (x) {
x.pid = x.pid += '';
db.portals.save(x);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment