【发布时间】:2013-12-07 16:57:11
【问题描述】:
PyMongo API 文档提到了一个杀死 mongodb 游标的函数:
kill_cursors(cursor_ids) Send a kill cursors message with the given ids.
Raises TypeError if cursor_ids is not an instance of list.
Parameters : cursor_ids: list of cursor ids to kill
但是,它没有指定(据我所知)如何实际找出光标的 id。我怎样才能得到这个?
from pymongo import Connection
c = Connection()
crawl = c.db.coll.find()
print crawl.id? <-- no idea how to get this
【问题讨论】:
-
一旦游标被执行,它就在 cursor._Cursor__id 中(在游标执行前会被设置为 0)
标签: python mongodb cursor pymongo