Created
June 15, 2017 11:10
-
-
Save nainglinaung/c27850af99ecc0ee12678a598f1372dc to your computer and use it in GitHub Desktop.
Revisions
-
nainglinaung created this gist
Jun 15, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ var devices = db.getCollection('devices').aggregate([ { "$group" : {_id:"$something" } } ]); var batch = devices._batch; for(i=0; i<=batch.length; i++) { if (batch[i]) { if (batch[i]._id) { if (typeof(batch[i]._id) == 'number') { db.devices.update({something:batch[i]._id},{$set : { something: batch[i]._id.toString() } },{multi:true}) } } } }