Skip to content

Instantly share code, notes, and snippets.

@Lazhari
Created July 23, 2015 08:58
Show Gist options
  • Save Lazhari/4e05fc1ec5876cd3963d to your computer and use it in GitHub Desktop.
Save Lazhari/4e05fc1ec5876cd3963d to your computer and use it in GitHub Desktop.
MongoDB queries : rename operator via $rename

db.users.update({}, {$rename: {'username': 'email', 'password': 'hashedPassword'}, false, true});

example :

Before : [{username: "[email protected]", password: "pwd"}]

after : [{email: "[email protected]", hashedPassword: "pwd"}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment