Skip to content

Instantly share code, notes, and snippets.

@danared
Created February 12, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danared/03bca8e1dd06588b1a63 to your computer and use it in GitHub Desktop.
Save danared/03bca8e1dd06588b1a63 to your computer and use it in GitHub Desktop.
mc = MongoClient()
db = mc.simplerandom
collection = db.names
number_of_documents = 100
load_data(collection, number_of_documents )
query = {'i': random.randint(0, number_of_documents ) }
winner = collection.find_one(query);
print "AND THE WINNER IS ..... " + winner['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment