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

Update aggregate tests for MongoDB 3.5+ support (3.x)

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5
    • Affects Version/s: None
    • Component/s: None
    • None

      SERVER-24623 removed support for single document aggregate command results. That is, the aggregate command now requires either the 'cursor' or 'explain' options. We have a few test cases that fail because of this change. This ticket tracks fixing them.

      ======================================================================
      ERROR: test_aggregate (test_collection.TestCollection)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/behackett/work/mongo-python-driver/test/test_collection.py", line 1487, in test_aggregate
          result = db.test.aggregate([pipeline], useCursor=False)
        File "/home/behackett/work/mongo-python-driver/pymongo/collection.py", line 1870, in aggregate
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/collection.py", line 232, in _command
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/pool.py", line 419, in command
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/network.py", line 116, in command
          parse_write_concern_error=parse_write_concern_error)
        File "/home/behackett/work/mongo-python-driver/pymongo/helpers.py", line 210, in _check_command_response
          raise OperationFailure(msg % errmsg, code, response)
      OperationFailure: The 'cursor' option is required, unless 'explain' is true
      
      ======================================================================
      ERROR: test_aggregate_raw_bson (test_collection.TestCollection)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/behackett/work/mongo-python-driver/test/test_collection.py", line 1509, in test_aggregate_raw_bson
          ).aggregate([pipeline], useCursor=False)
        File "/home/behackett/work/mongo-python-driver/pymongo/collection.py", line 1870, in aggregate
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/collection.py", line 232, in _command
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/pool.py", line 419, in command
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/network.py", line 116, in command
          parse_write_concern_error=parse_write_concern_error)
        File "/home/behackett/work/mongo-python-driver/pymongo/helpers.py", line 210, in _check_command_response
          raise OperationFailure(msg % errmsg, code, response)
      OperationFailure: The 'cursor' option is required, unless 'explain' is true
      
      ======================================================================
      ERROR: test_command_with_regex (test_database.TestDatabase)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/behackett/work/mongo-python-driver/test/__init__.py", line 326, in wrap
          return f(*args, **kwargs)
        File "/home/behackett/work/mongo-python-driver/test/test_database.py", line 357, in test_command_with_regex
          result = db.command('aggregate', 'test', pipeline=[])
        File "/home/behackett/work/mongo-python-driver/pymongo/database.py", line 494, in command
          codec_options, **kwargs)
        File "/home/behackett/work/mongo-python-driver/pymongo/database.py", line 406, in _command
          parse_write_concern_error=parse_write_concern_error)
        File "/home/behackett/work/mongo-python-driver/pymongo/pool.py", line 419, in command
          collation=collation)
        File "/home/behackett/work/mongo-python-driver/pymongo/network.py", line 116, in command
          parse_write_concern_error=parse_write_concern_error)
        File "/home/behackett/work/mongo-python-driver/pymongo/helpers.py", line 210, in _check_command_response
          raise OperationFailure(msg % errmsg, code, response)
      OperationFailure: The 'cursor' option is required, unless 'explain' is true
      

            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: