Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongomock $size queries match all non-array fields for {$size: 1}, even nulls #807

Closed
ml-evs opened this issue May 17, 2021 · 3 comments · Fixed by #797 or #836
Closed

mongomock $size queries match all non-array fields for {$size: 1}, even nulls #807

ml-evs opened this issue May 17, 2021 · 3 comments · Fixed by #797 or #836
Assignees
Labels
priority/low Issue or PR with a consensus of low priority transformer/MongoDB Related to filter transformer for MongoDB

Comments

@ml-evs
Copy link
Member

ml-evs commented May 17, 2021

In MongoDB mongomock, the query {<field>: {"$size": 1}} seems to match all documents, even if the field is missing. We should add a check for field existence too.

We can temporarily patch our queries until mongomock is fixed (I have submitted a PR, release cycle is slow-ish), or we can disable certain test for mongomock.

@ml-evs
Copy link
Member Author

ml-evs commented May 24, 2021

Pretty sure this is actually a mongomock issue, see mongomock/mongomock#710

@ml-evs ml-evs changed the title MongoDB $size queries match all non-array fields for {$size: 1}, even nulls mongomock $size queries match all non-array fields for {$size: 1}, even nulls May 24, 2021
@ml-evs
Copy link
Member Author

ml-evs commented May 24, 2021

My PR has been merged into mongomock and I have requested a release. Worth waiting for if it comes out within a few days as we can simply our postprocessing code.

ml-evs added a commit that referenced this issue May 26, 2021
- Skip unknown length test for mongomock, temporarily
ml-evs added a commit that referenced this issue May 27, 2021
- Skip unknown length test for mongomock, temporarily
ml-evs added a commit that referenced this issue May 27, 2021
- Skip unknown length test for mongomock, temporarily
ml-evs added a commit that referenced this issue May 27, 2021
- Skip unknown length test for mongomock, temporarily
ml-evs added a commit that referenced this issue May 27, 2021
- Skip unknown length test for mongomock, temporarily
ml-evs added a commit that referenced this issue May 31, 2021
- Skip unknown length test for mongomock, temporarily
@ml-evs
Copy link
Member Author

ml-evs commented May 31, 2021

This has not been resolved in #797, which instead just disables a few tests for mongomock. We must wait for the next mongomock release to re-enable them.

@ml-evs ml-evs reopened this May 31, 2021
@ml-evs ml-evs added priority/low Issue or PR with a consensus of low priority and removed priority/medium Issue or PR with a consensus of medium priority labels May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/low Issue or PR with a consensus of low priority transformer/MongoDB Related to filter transformer for MongoDB
Projects
None yet
1 participant