Skip to content

Instantly share code, notes, and snippets.

@kamotos
Last active December 24, 2015 07:19
Show Gist options
  • Save kamotos/6763265 to your computer and use it in GitHub Desktop.
Save kamotos/6763265 to your computer and use it in GitHub Desktop.
use socialiq;
var documents_count = 0;
db.crawler_users.find({_id: {$type: 7}}).forEach(function(doc){
documentsCount++;
var sleepTime = (documentsCount % 10) ? 1000 : 0;
setTimeout(function(){
var id=doc._id;
doc._id=doc.id;
db.crawler_users.remove({_id:id});
db.crawler_users.insert(doc);
}, sleepTime);
console.log(documentsCount);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment