def get_run(self, run_id):
"""
Get a single run from the database.
:param run_id: The ID of the run.
:return: The whole object from the database.
"""
try:
cursor = getattr(self._db, self._collection_name) \
.find({"_id": int(run_id)})
except ValueError:
# Probably not a number.
cursor = getattr(self._db, self._collection_name) \
.find({"_id": bson.ObjectId(run_id)})
run = None
for c in cursor:
run = c
return run
评论列表
文章目录