Created
November 28, 2016 15:22
-
-
Save lifeisfoo/e60e46957214ae58efe506f8a91dc556 to your computer and use it in GitHub Desktop.
Lowercase a field
This file contains 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.products.find().forEach( | |
function(doc) { | |
if (!!doc.variants) { | |
for (i = 0, len = doc.variants.length; i < len; i++) { | |
doc.variants[i].sku = doc.variants[i].sku.toLowerCase(); | |
} | |
} | |
db.products.save(doc); | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment