Skip to content

Conversation

@Amanbig
Copy link

@Amanbig Amanbig commented Feb 7, 2026

Planned Work

  • Implement count_documents_by_filter
    (following the behavior of OpenSearchDocumentStore)

  • Implement count_unique_metadata_by_filter
    (aligned with existing implementations in other document stores)

  • Implement get_metadata_fields_info
    (using sample-based inference, similar to OpenSearch)

  • Implement get_metadata_field_min_max

  • Implement get_metadata_field_unique_values
    (consistent with the MongoDB implementation in add the following operations to MongoDBDocumentStore #2640)

  • Add async counterparts for all new methods

  • Add integration tests for the new functionality


Related Issues


Proposed Changes

This work adds missing metadata and aggregation operations to MongoDBDocumentStore, bringing it in line with other Haystack document stores.
The implementation follows patterns already used in OpenSearch and MongoDB integrations to keep behavior consistent across backends.


How Did You Test It?

  • Added integration tests for all new methods
  • Ensured parity with MongoDB and OpenSearch implementations

Notes for the Reviewer


Checklist

- Implement [count_documents_by_filter](cci:1://file:///c:/Users/ROGST/Documents/Programming/python/haystack-core-integrations/integrations/opensearch/src/haystack_integrations/document_stores/opensearch/document_store.py:1537:4-1550:72)
- Implement [count_unique_metadata_by_filter](cci:1://file:///c:/Users/ROGST/Documents/Programming/python/haystack-core-integrations/integrations/opensearch/src/haystack_integrations/document_stores/opensearch/document_store.py:1624:4-1664:9)
- Implement [get_metadata_fields_info](cci:1://file:///c:/Users/ROGST/Documents/Programming/python/haystack-core-integrations/integrations/opensearch/src/haystack_integrations/document_stores/opensearch/document_store.py:1710:4-1741:28) (using sample-based inference)
- Implement [get_metadata_field_min_max](cci:1://file:///c:/Users/ROGST/Documents/Programming/python/haystack-core-integrations/integrations/mongodb_atlas/src/haystack_integrations/document_stores/mongodb_atlas/document_store.py:421:4-447:48)
- Implement [get_metadata_field_unique_values](cci:1://file:///c:/Users/ROGST/Documents/Programming/python/haystack-core-integrations/integrations/mongodb_atlas/src/haystack_integrations/document_stores/mongodb_atlas/document_store.py:449:4-491:48)
- Add async counterparts for all new methods
- Add integration tests for new functionality
@Amanbig Amanbig requested a review from a team as a code owner February 7, 2026 18:56
@Amanbig Amanbig requested review from sjrl and removed request for a team February 7, 2026 18:56
@CLAassistant
Copy link

CLAassistant commented Feb 7, 2026

CLA assistant check
All committers have signed the CLA.

Amanbig and others added 2 commits February 8, 2026 00:39
- Implement count_documents_by_filter (renamed ilter arg to ilters to fix shadowing)
- Implement count_unique_metadata_by_filter
- Implement get_metadata_fields_info
- Implement get_metadata_field_min_max
- Implement get_metadata_field_unique_values (uses 
e.escape for safety)
- Add async counterparts
- Fix docstring line lengths and formatting
@davidsbatista
Copy link
Contributor

The following methods need to be implemented

  • get_metadata_fields_info_async()
  • get_metadata_field_min_max_async()
  • get_metadata_field_unique_values_async()

@Amanbig
Copy link
Author

Amanbig commented Feb 10, 2026

Thanks for the review, @davidsbatista!
I agree — the async and sync implementations share common logic. I’ll refactor the duplicated parts into a shared helper and update both methods accordingly.

I’ll also go ahead and implement the remaining async methods:

  • get_metadata_fields_info_async()
  • get_metadata_field_min_max_async()
  • get_metadata_field_unique_values_async()

Will push the updates shortly.

- implemented get_metadata_fields_info_async, get_metadata_field_min_max_async, and get_metadata_field_unique_values_async

- refactored synchronous methods to use shared helper functions

- added unit tests for new async methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:mongodb-atlas type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add the following operations to MongoDBDocumentStore

3 participants