Skip to content

Instantly share code, notes, and snippets.

@swayson
Created March 3, 2015 07:19
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 swayson/3bd98a1707ecb5992362 to your computer and use it in GitHub Desktop.
Save swayson/3bd98a1707ecb5992362 to your computer and use it in GitHub Desktop.
MongoDB Find generator
from pymongo.connection import Connection
m = Connection()
db = m.reddit
votes = db.votes
cursor = votes.find().skip(0).limit(50000)
print "Setup cursor: %s" % cursor
def iter():
for item in cursor:
yield item
for x in iter():
print x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment