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

[AI/ML Testing Pipeline] test-docarray "failed with invalid parameter: expected an object (filter)"

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: AI/ML
    • None
    • Python Drivers

      EVG

      Detailed steps to reproduce the problem?

       

       [2024/07/26 12:14:13.346] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       [2024/07/26 12:14:13.346] tests/index/mongo_atlas/__init__.py:38: in assert_when_ready
       [2024/07/26 12:14:13.346]     callable()
       [2024/07/26 12:14:13.346] tests/index/mongo_atlas/test_subindex.py:222: in predicate
       [2024/07/26 12:14:13.346]     root_docs, docs, scores = index.find_subindex(
       [2024/07/26 12:14:13.346] docarray/index/abstract.py:532: in find_subindex
       [2024/07/26 12:14:13.346]     sub_docs, scores = self._find_subdocs(
       [2024/07/26 12:14:13.346] docarray/index/abstract.py:1184: in _find_subdocs
       [2024/07/26 12:14:13.346]     return self._subindices[fields[0]]._find_subdocs(
       [2024/07/26 12:14:13.346] docarray/index/abstract.py:1180: in _find_subdocs
       [2024/07/26 12:14:13.346]     return self._subindices[fields[0]].find(
       [2024/07/26 12:14:13.346] docarray/index/abstract.py:503: in find
       [2024/07/26 12:14:13.346]     docs, scores = self._find(
       [2024/07/26 12:14:13.346] docarray/index/backends/mongodb_atlas.py:628: in _find
       [2024/07/26 12:14:13.346]     with self._collection.aggregate(pipeline) as cursor:
       [2024/07/26 12:14:13.346] venv/lib/python3.10/site-packages/pymongo/collection.py:2720: in aggregate
       [2024/07/26 12:14:13.346]     return self._aggregate(
       [2024/07/26 12:14:13.346] venv/lib/python3.10/site-packages/pymongo/_csot.py:107: in csot_wrapper
       [2024/07/26 12:14:13.346]     return func(self, *args, **kwargs)
       [2024/07/26 12:14:13.346] venv/lib/python3.10/site-packages/pymongo/collection.py:2627: in _aggregate
       [2024/07/26 12:14:13.346]     return self.__database.client._retryable_read(
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/mongo_client.py:1492: in _retryable_read
       [2024/07/26 12:14:13.347]     return self._retry_internal(
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/_csot.py:107: in csot_wrapper
       [2024/07/26 12:14:13.347]     return func(self, *args, **kwargs)
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/mongo_client.py:1462: in _retry_internal
       [2024/07/26 12:14:13.347]     ).run()
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/mongo_client.py:2315: in run
       [2024/07/26 12:14:13.347]     return self._read() if self._is_read else self._write()
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/mongo_client.py:2445: in _read
       [2024/07/26 12:14:13.347]     return self._func(self._session, self._server, conn, read_pref)  # type: ignore
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/aggregation.py:164: in get_cursor
       [2024/07/26 12:14:13.347]     result = conn.command(
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/helpers.py:322: in inner
       [2024/07/26 12:14:13.347]     return func(*args, **kwargs)
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/pool.py:968: in command
       [2024/07/26 12:14:13.347]     return command(
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/network.py:192: in command
       [2024/07/26 12:14:13.347]     helpers._check_command_response(
       [2024/07/26 12:14:13.347] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       [2024/07/26 12:14:13.347] response = {'$clusterTime': {'clusterTime': Timestamp(1722010450, 28), 'signature': {'hash': b"@\xf9\xe0\x17\xc6h@=\x05\xa1'\xf2p...2542977}}, 'code': 10065, 'codeName': 'Location10065', 'errmsg': 'invalid parameter: expected an object (filter)', ...}
       [2024/07/26 12:14:13.347] max_wire_version = 17, allowable_errors = None, parse_write_concern_error = True
       [2024/07/26 12:14:13.347]     def _check_command_response(
       [2024/07/26 12:14:13.347]         response: _DocumentOut,
       [2024/07/26 12:14:13.347]         max_wire_version: Optional[int],
       [2024/07/26 12:14:13.347]         allowable_errors: Optional[Container[Union[int, str]]] = None,
       [2024/07/26 12:14:13.347]         parse_write_concern_error: bool = False,
       [2024/07/26 12:14:13.347]     ) -> None:
       [2024/07/26 12:14:13.347]         """Check the response to a command for errors."""
       [2024/07/26 12:14:13.347]         if "ok" not in response:
       [2024/07/26 12:14:13.347]             # Server didn't recognize our message as a command.
       [2024/07/26 12:14:13.347]             raise OperationFailure(
       [2024/07/26 12:14:13.347]                 response.get("$err"),  # type: ignore[arg-type]
       [2024/07/26 12:14:13.347]                 response.get("code"),
       [2024/07/26 12:14:13.347]                 response,
       [2024/07/26 12:14:13.347]                 max_wire_version,
       [2024/07/26 12:14:13.347]             )
       [2024/07/26 12:14:13.347]         if parse_write_concern_error and "writeConcernError" in response:
       [2024/07/26 12:14:13.347]             _error = response["writeConcernError"]
       [2024/07/26 12:14:13.347]             _labels = response.get("errorLabels")
       [2024/07/26 12:14:13.347]             if _labels:
       [2024/07/26 12:14:13.347]                 _error.update({"errorLabels": _labels})
       [2024/07/26 12:14:13.347]             _raise_write_concern_error(_error)
       [2024/07/26 12:14:13.347]         if response["ok"]:
       [2024/07/26 12:14:13.347]             return
       [2024/07/26 12:14:13.347]         details = response
       [2024/07/26 12:14:13.347]         # Mongos returns the error details in a 'raw' object
       [2024/07/26 12:14:13.347]         # for some errors.
       [2024/07/26 12:14:13.347]         if "raw" in response:
       [2024/07/26 12:14:13.347]             for shard in response["raw"].values():
       [2024/07/26 12:14:13.347]                 # Grab the first non-empty raw error from a shard.
       [2024/07/26 12:14:13.347]                 if shard.get("errmsg") and not shard.get("ok"):
       [2024/07/26 12:14:13.347]                     details = shard
       [2024/07/26 12:14:13.347]                     break
       [2024/07/26 12:14:13.347]         errmsg = details["errmsg"]
       [2024/07/26 12:14:13.347]         code = details.get("code")
       [2024/07/26 12:14:13.347]         # For allowable errors, only check for error messages when the code is not
       [2024/07/26 12:14:13.347]         # included.
       [2024/07/26 12:14:13.347]         if allowable_errors:
       [2024/07/26 12:14:13.347]             if code is not None:
       [2024/07/26 12:14:13.347]                 if code in allowable_errors:
       [2024/07/26 12:14:13.347]                     return
       [2024/07/26 12:14:13.347]             elif errmsg in allowable_errors:
       [2024/07/26 12:14:13.347]                 return
       [2024/07/26 12:14:13.347]         # Server is "not primary" or "recovering"
       [2024/07/26 12:14:13.347]         if code is not None:
       [2024/07/26 12:14:13.347]             if code in _NOT_PRIMARY_CODES:
       [2024/07/26 12:14:13.347]                 raise NotPrimaryError(errmsg, response)
       [2024/07/26 12:14:13.347]         elif HelloCompat.LEGACY_ERROR in errmsg or "node is recovering" in errmsg:
       [2024/07/26 12:14:13.347]             raise NotPrimaryError(errmsg, response)
       [2024/07/26 12:14:13.347]         # Other errors
       [2024/07/26 12:14:13.347]         # findAndModify with upsert can raise duplicate key error
       [2024/07/26 12:14:13.347]         if code in (11000, 11001, 12582):
       [2024/07/26 12:14:13.347]             raise DuplicateKeyError(errmsg, code, response, max_wire_version)
       [2024/07/26 12:14:13.347]         elif code == 50:
       [2024/07/26 12:14:13.347]             raise ExecutionTimeout(errmsg, code, response, max_wire_version)
       [2024/07/26 12:14:13.347]         elif code == 43:
       [2024/07/26 12:14:13.347]             raise CursorNotFound(errmsg, code, response, max_wire_version)
       [2024/07/26 12:14:13.347] >       raise OperationFailure(errmsg, code, response, max_wire_version)
       [2024/07/26 12:14:13.347] E       pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010450, 28), 'signature': {'hash': b"@\xf9\xe0\x17\xc6h@=\x05\xa1'\xf2p\x06rH\xff\xe2\xe6A", 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010450, 28)}
       [2024/07/26 12:14:13.347] venv/lib/python3.10/site-packages/pymongo/helpers.py:230: OperationFailure
       [2024/07/26 12:14:13.347] =============================== warnings summary ===============================
       [2024/07/26 12:14:13.347] docarray/helper.py:224
       [2024/07/26 12:14:13.347]   /data/mci/c8f46c90dad8808e013d36adf7c3674e/src/docarray/docarray/docarray/helper.py:224: DeprecationWarning: invalid escape sequence '\*'
       [2024/07/26 12:14:13.347]     """
       [2024/07/26 12:14:13.347] tests/index/mongo_atlas/test_query_builder.py:309
       [2024/07/26 12:14:13.347]   tests/index/mongo_atlas/test_query_builder.py:309: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_hybrid_search_vectors_with_different_fields will be ignored
       [2024/07/26 12:14:13.347]     @pytest.mark.skip
       [2024/07/26 12:14:13.347] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
       [2024/07/26 12:14:13.347] =========================== short test summary info ============================
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_find.py::test_find_simple_schema - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010439, 51), 'signature': {'hash': b'\xf8<YN\x1c\xd5dD\x82x\xc1jy \r\xbf\xb8\xb8\x8b\xa0', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010439, 51)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_find.py::test_find_empty_index - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010439, 62), 'signature': {'hash': b'\xf8<YN\x1c\xd5dD\x82x\xc1jy \r\xbf\xb8\xb8\x8b\xa0', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010439, 62)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_find.py::test_find_limit_larger_than_index - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010440, 11), 'signature': {'hash': b'`#N\xee\x8e\x08\x8f\xfe\x87\x04\x98_\xfd\xc4]&\xfbv\xe7{', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010440, 11)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_find.py::test_find_flat_schema - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010440, 46), 'signature': {'hash': b'`#N\xee\x8e\x08\x8f\xfe\x87\x04\x98_\xfd\xc4]&\xfbv\xe7{', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010440, 46)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_find.py::test_find_batches - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010440, 56), 'signature': {'hash': b'`#N\xee\x8e\x08\x8f\xfe\x87\x04\x98_\xfd\xc4]&\xfbv\xe7{', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010440, 56)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_find.py::test_find_nested_schema - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010441, 13), 'signature': {'hash': b'<\x9d\x0f\x0bKB<w\xd2\xf8\xd2\x1c\x01\xae\xa5\x94u\xc1\xd6\xda', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010441, 13)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_index_get_del.py::test_num_docs - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010441, 44), 'signature': {'hash': b'<\x9d\x0f\x0bKB<w\xd2\xf8\xd2\x1c\x01\xae\xa5\x94u\xc1\xd6\xda', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010441, 44)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_persist_data.py::test_persist - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010442, 60), 'signature': {'hash': b'\x11\xc5\xdf\x8dh3d?\xd1\\0\x10\x8e\xec\n\xd8C\x17\xa8j', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010442, 60)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_query_builder.py::test_find - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010448, 60), 'signature': {'hash': b'3\x82qx\x03\xa2\x91k\x0e\xeb\xc4\x8e\xfa[)\x1f\xd9\xe9\x86\x05', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010448, 60)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_query_builder.py::test_hybrid_search - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010449, 20), 'signature': {'hash': b'#+\x96)v\x1d\x11*\x97 \x0e1\xf0\xf8\xaehV\xe9$.', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010449, 20)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_query_builder.py::test_hybrid_search_multiple_text - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010449, 40), 'signature': {'hash': b'#+\x96)v\x1d\x11*\x97 \x0e1\xf0\xf8\xaehV\xe9$.', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010449, 40)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_query_builder.py::test_hybrid_search_only_vector - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010449, 80), 'signature': {'hash': b'#+\x96)v\x1d\x11*\x97 \x0e1\xf0\xf8\xaehV\xe9$.', 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010449, 80)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_subindex.py::test_find_subindex_sublevel - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010450, 28), 'signature': {'hash': b"@\xf9\xe0\x17\xc6h@=\x05\xa1'\xf2p\x06rH\xff\xe2\xe6A", 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010450, 28)}
       [2024/07/26 12:14:13.347] FAILED tests/index/mongo_atlas/test_subindex.py::test_find_subindex_subsublevel - pymongo.errors.OperationFailure: invalid parameter: expected an object (filter), full error: {'ok': 0.0, 'errmsg': 'invalid parameter: expected an object (filter)', 'code': 10065, 'codeName': 'Location10065', '$clusterTime': {'clusterTime': Timestamp(1722010450, 28), 'signature': {'hash': b"@\xf9\xe0\x17\xc6h@=\x05\xa1'\xf2p\x06rH\xff\xe2\xe6A", 'keyId': 7359193807612542977}}, 'operationTime': Timestamp(1722010450, 28)}
       [2024/07/26 12:14:13.347] ============ 14 failed, 27 passed, 1 skipped, 2 warnings in 14.41s ============= 

       

       

      Definition of done: what must be done to consider the task complete?

      Error message fixed

      The exact Python version used, with patch level:

      $ python -c "import sys; print(sys.version)"

      The exact version of PyMongo used, with patch level:

      $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            casey.clements@mongodb.com Casey Clements
            Reporter:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: