Created
September 21, 2016 03:37
-
-
Save thanhpk/06c87f02c9e19d3e209099fa9bde2156 to your computer and use it in GitHub Desktop.
Duplicate location finder
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 n = 0; | |
var myCursor = db.warehouseproducts.find(); | |
while (myCursor.hasNext()) { | |
var doc = myCursor.next(); | |
var locationMap = {}; | |
for (var i = 0 ; i < doc.locations.length; i++) | |
if (locationMap[doc.locations[i].location.str] !== undefined) { | |
printjson(doc._id); | |
n++; | |
break; | |
} | |
else locationMap[doc.locations[i].location.str] = 1; | |
} | |
print(n); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment