00001 import pymongo as pm
00002
00003 def generate_run_id(db):
00004 runs = db['runs']
00005 cursor = runs.find({}).sort('id', pm.DESCENDING)
00006 largest = next(cursor, None)
00007 return largest['id']+1 if largest else 1
00008
00009 def collection_name(run, coll):
00010 return run+'_'+coll
00011