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

Test failure - Spec tests for findAndModify fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.9
    • Tests
    • None

    Description

      Our spec tests for findAndModify accidentally send "returnDocument" as a command argument which is causing latest (v4.1.10-294-g59a22d074e) to fail. The server must have recently implemented stricter command parsing for findAndModify:

      ERROR [0.030s]: test_write_findOneAndReplace_FindOneAndReplace_when_many_documents_match_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.047s]: test_write_findOneAndReplace_FindOneAndReplace_when_no_documents_match_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.027s]: test_write_findOneAndReplace_FindOneAndReplace_when_one_document_matches_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.025s]: test_write_findOneAndReplace_collation_FindOneAndReplace_when_one_document_matches_with_collation_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.024s]: test_write_findOneAndReplace_upsert_FindOneAndReplace_when_no_documents_match_with_id_specified_with_upsert_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.028s]: test_write_findOneAndReplace_upsert_FindOneAndReplace_when_no_documents_match_without_id_specified_with_upsert_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.026s]: test_write_findOneAndUpdate_FindOneAndUpdate_when_many_documents_match_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.028s]: test_write_findOneAndUpdate_FindOneAndUpdate_when_no_documents_match_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.025s]: test_write_findOneAndUpdate_FindOneAndUpdate_when_no_documents_match_with_upsert_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.033s]: test_write_findOneAndUpdate_FindOneAndUpdate_when_one_document_matches_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ERROR [0.056s]: test_transactions_findOneAndReplace_collection_writeConcern_ignored_for_findOneAndReplace (test_transactions.TestTransactions)
      ERROR [0.055s]: test_transactions_findOneAndReplace_findOneAndReplace (test_transactions.TestTransactions)
      ERROR [0.060s]: test_transactions_findOneAndUpdate_collection_writeConcern_ignored_for_findOneAndUpdate (test_transactions.TestTransactions)
      ERROR [0.060s]: test_transactions_findOneAndUpdate_findOneAndUpdate (test_transactions.TestTransactions)
      ERROR [0.061s]: test_transactions_write_concern_unacknowledged_write_concern_coll_findOneAndReplace (test_transactions.TestTransactions)
      ERROR [0.052s]: test_transactions_write_concern_unacknowledged_write_concern_coll_findOneAndUpdate (test_transactions.TestTransactions)
      

      A full stack trace looks like this:

      ERROR [0.030s]: test_write_findOneAndReplace_FindOneAndReplace_when_many_documents_match_returning_the_document_after_modification (test_crud_v1.TestAllScenarios)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/test/__init__.py", line 410, in wrap
       return f(*args, **kwargs)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/test/test_crud_v1.py", line 159, in run_scenario
       result = run_operation(self.db.test, test)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/test/test_crud_v1.py", line 129, in run_operation
       result = cmd(**arguments)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/collection.py", line 3052, in find_one_and_replace
       session=session, **kwargs)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/collection.py", line 2915, in __find_and_modify
       write_concern.acknowledged, _find_and_modify, session)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/mongo_client.py", line 1463, in _retryable_write
       return self._retry_with_session(retryable, func, s, None)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/mongo_client.py", line 1364, in _retry_with_session
       return func(session, sock_info, retryable)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/collection.py", line 2909, in _find_and_modify
       user_fields=_FIND_AND_MODIFY_DOC_FIELDS)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/collection.py", line 247, in _command
       user_fields=user_fields)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/pool.py", line 584, in command
       user_fields=user_fields)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/network.py", line 158, in command
       parse_write_concern_error=parse_write_concern_error)
       File "/data/mci/9dc8d2c277205833c62a2d47c44285a0/src/pymongo/helpers.py", line 155, in _check_command_response
       raise OperationFailure(msg % errmsg, code, response)
      OperationFailure: BSON field 'returnDocument' is an unknown field.
      

      Attachments

        Activity

          People

            shane.harvey@mongodb.com Shane Harvey
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: