mongodb.py 文件源码

python
阅读 97 收藏 0 点赞 0 评论 0

项目:sacredboard 作者: chovanecm 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号