Skip to content

Instantly share code, notes, and snippets.

@jgonera
Created October 21, 2011 13:37
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 jgonera/1303871 to your computer and use it in GitHub Desktop.
Save jgonera/1303871 to your computer and use it in GitHub Desktop.
Python MongoDB performance test
from pymongo import Connection
from pymongo.objectid import ObjectId
connection = Connection()
db = connection.coledit_development
def test():
project = db.projects.find_one({'_id': ObjectId('4e52ccbd3a5c9f20b8000003')})
#print project['name']
from timeit import Timer
t = Timer("test()", "from __main__ import test")
print t.timeit(10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment