Last active
August 29, 2015 14:20
-
-
Save fabiocarneiro/cb539c48bd115fbcc0ca to your computer and use it in GitHub Desktop.
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
0 undefined | |
1 undefined | |
> |
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
var count = 0; | |
var c = db.Supplier.find(); | |
while(c.hasNext()) { | |
var i = c.next(); | |
var col = i.supplies; | |
for (j in col) { | |
col[j].price = { | |
wholesalePrice: col[j].price, | |
retailPrice: col[j].suggestedPrice | |
}; | |
delete col[j].suggestedPrice; | |
} | |
print(count++, db.Supplier.update({id: i._id}, {$set: {supplies: col}})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment