Skip to content

Instantly share code, notes, and snippets.

@fbjork
Created July 20, 2011 18:43
Show Gist options
  • Save fbjork/1095612 to your computer and use it in GitHub Desktop.
Save fbjork/1095612 to your computer and use it in GitHub Desktop.
function createFeeds() {
var limit = 10000;
var users = db.users.find().limit(limit);
var skip = 0;
while(users.length() > 0) {
for (i = 0; i < users.length(); i++) {
doc = {home_activities_count: 0, home_activity_ids: [], profile_activities_count: 0, profile_activity_ids: [], user_id: users[i]['_id']};
db.feeds.insert(doc);
}
skip = skip + limit;
users = db.users.find().skip(skip).limit(limit);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment