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

create_search_index should only send the "type" field when provided

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.7
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Related to PYTHON-4208. the search index model "type" field should only be sent to the server if the user provides a value. Currently we send "type: search" by default which causes problems in the test suite:

       [2024/04/03 04:35:13.639] FAILURE: AssertionError: Items in the second set but not the first:
       [2024/04/03 04:35:13.639] 'type' ()
       [2024/04/03 04:35:13.639] self = <test.test_index_management.TestIndexManagementCreateSearchIndex testMethod=test_name_provided_for_an_index_definition>
       [2024/04/03 04:35:13.639]     def test_case(self):
       [2024/04/03 04:35:13.639] >       self.run_scenario(spec)
       [2024/04/03 04:35:13.639] test/unified_format.py:1909: 
       [2024/04/03 04:35:13.639] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/04/03 04:35:13.639] test/unified_format.py:1856: in run_scenario
       [2024/04/03 04:35:13.639]     self._run_scenario(spec, uri)
       [2024/04/03 04:35:13.639] test/unified_format.py:1892: in _run_scenario
       [2024/04/03 04:35:13.639]     self.check_events(expect_events)
       [2024/04/03 04:35:13.639] test/unified_format.py:1764: in check_events
       [2024/04/03 04:35:13.639]     self.match_evaluator.match_event(event_type, expected_event, actual_events[idx])
       [2024/04/03 04:35:13.639] test/unified_format.py:865: in match_event
       [2024/04/03 04:35:13.639]     self.match_result(command, actual.command)
       [2024/04/03 04:35:13.639] test/unified_format.py:792: in match_result
       [2024/04/03 04:35:13.639]     return self._match_document(expectation, actual, is_root=not in_recursive_call)
       [2024/04/03 04:35:13.639] test/unified_format.py:781: in _match_document
       [2024/04/03 04:35:13.639]     self.match_result(value, actual[key], in_recursive_call=True)
       [2024/04/03 04:35:13.639] test/unified_format.py:798: in match_result
       [2024/04/03 04:35:13.639]     self._match_document(e, a, is_root=not in_recursive_call)
       [2024/04/03 04:35:13.639] test/unified_format.py:788: in _match_document
       [2024/04/03 04:35:13.639]     self.test.assertEqual(expected_keys, set(actual.keys()))
       [2024/04/03 04:35:13.639] E   AssertionError: Items in the second set but not the first:
       [2024/04/03 04:35:13.639] E   'type'
      

      https://spruce.mongodb.com/task/mongo_python_driver_tests_python_version_rhel8_test_ssl__platform~rhel8_auth_ssl~auth_ssl_python_version~3.10_coverage~coverage_test_7.0_replica_set_c154c6b67ba9fd0f925fede1f524aeb5d91cb33b_24_04_03_11_17_51/tests?execution=0&sortBy=STATUS&sortDir=ASC

      It's also inconsistent with other operations like collation, bypasDocumentValidation, and IndexModel where we only send a field if the user explicitly provides it.

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

              Created:
              Updated:
              Resolved: