Skip to content

Instantly share code, notes, and snippets.

@csanz
Created August 8, 2011 19:37
Show Gist options
  • Save csanz/1132527 to your computer and use it in GitHub Desktop.
Save csanz/1132527 to your computer and use it in GitHub Desktop.
Geeklist Home Screen Randomizer
db.users.find().forEach(function(user) {
if(user.company){
db.users.update({_id: user._id}, { $set: { random: Math.random(), is_featured: true }});
}else{
db.users.update({_id: user._id}, { $set: { is_featured: false }});
}
});
db.users.find({is_featured: true},{screen_name:1}).limit(10).sort({random: 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment