Skip to content

Conversation

terencehonles
Copy link
Contributor

This change adds the _ref or _ref.$id prefix to a query if all values in an iterable query (i.e. __in) are ObjectIds or DBRefs and raises an error for a mixed query which will only work for documents. These could possibly be compiled into an {$or: ...} query, but the automatic expansion can be added as necessary.

@terencehonles terencehonles force-pushed the fix-generic-reference-iterable-query branch 2 times, most recently from b0745ca to 09b9fd3 Compare May 28, 2025 08:15
@terencehonles
Copy link
Contributor Author

This should be merged after #2887 as I've pulled that in to be able to run the CI checks

@bagerard
Copy link
Collaborator

Could you add tests for this?

@terencehonles terencehonles force-pushed the fix-generic-reference-iterable-query branch 3 times, most recently from 95fc3d2 to 9c69368 Compare August 18, 2025 13:13
This change adds the ``_ref`` or ``_ref.$id`` prefix to a query if all
values in an iterable query (i.e. ``__in``) are ``ObjectId``s or
``DBRef``s and raises an error for a mixed query which will only work
for documents. These could possibly be compiled into an ``{$or: ...}``
query, but the automatic expansion can be added as necessary.
@terencehonles terencehonles force-pushed the fix-generic-reference-iterable-query branch from 9c69368 to 01838b8 Compare August 18, 2025 13:15
@terencehonles
Copy link
Contributor Author

Could you add tests for this?

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants