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

The type of connection_id for killCursors events differs depending on server version

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5
    • Affects Version/s: 3.1, 3.2, 3.3, 3.4
    • Component/s: None
    • Minor Change

      killCursors events for MongoDB >= 3.2 publish connection_id as an instance of tuple. For MongoDB < 3.2 connection_id is published as an internal type, _CursorAddress, a subclass of tuple with an extra attribute.

      This was uncovered by a test failure under Jython, which appears to consider exact subclass in comparisons:

      ======================================================================
      FAIL: test_kill_cursors (test.test_monitoring.TestCommandMonitoring)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "test/test_monitoring.py", line 508, in test_kill_cursors
          self.assertEqual(cursor.address, started.connection_id)
      AssertionError: (u'localhost', 27017) != (u'localhost', 27017)
      

      We'll fix this by always publishing a tuple, rather than the subclass, to match the rest of the monitoring API. This change could be a backward breaking change for some application somewhere (though that's extremely unlikely).

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: