Skip to content

Instantly share code, notes, and snippets.

@jmikola
Created August 27, 2010 19:22
Show Gist options
  • Save jmikola/554004 to your computer and use it in GitHub Desktop.
Save jmikola/554004 to your computer and use it in GitHub Desktop.
Normalize address countries to uppercase
var cols = ['customers', 'sellers', 'suppliers'];
for (j in cols) {
db[cols[j]].find({'addresses.country':/[a-z]/}).forEach(function(d){
for (i in d.addresses) {
d.addresses[i].country = d.addresses[i].country.toUpperCase();
}
db[cols[j]].save(d);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment