Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-988

Deprecate cursor managers and MongoClient.kill_cursors

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3
    • Affects Version/s: None
    • Component/s: None
    • None

      For the sake of backwards compatibility, MongoClient.kill_cursors doesn't require a server address to tell the client which server in a replica set or set of mongoses to kill the cursor on. When called without an address, it's only reliable if connected to a single server.

      Beginning with MongoDB 3.2 we begin migrating from the OP_KILLCURSORS message to the killCursors command (PYTHON-978), which requires the cursor's original database and collection name as well as its id. Again, MongoClient.kill_cursors doesn't require these parameters. For now, PyMongo can kill a cursor without its namespace by falling back to the legacy OP_KILLCURSORS message, but there will come a MongoDB version that does not support the old message.

      Deprecate MongoClient.kill_cursors: it doesn't require the proper set of parameters to work with compound server topologies, and will eventually stop working with modern wire protocols.

      We could make a breaking change in the next major version, and require the server address and cursor namespace, but it's unnecessary: Cursor.close() can always kill the cursor correctly. There's no need for a separate kill-cursors function.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: