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

[BUG] wrong condition convertion on comparing two fields #959

Open
Karmenzind opened this issue Jul 2, 2024 · 2 comments
Open

[BUG] wrong condition convertion on comparing two fields #959

Karmenzind opened this issue Jul 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Karmenzind
Copy link

Describe the bug
I need to compare two fields with model.field1 > model.field2 but Beanio generated the wrong filter.

My model is like:

class H(Document):
    last_sms_time: datetime
    next_sms_time: datetime

And H.find(H.next_sms_time < H.last_sms_time).get_filter_query() returned {'next_sms_time': {'$lt': 'last_sms_time'}} that compares next_sms_time with literal string 'last_sms_time'.

But the correct filter that will be recognized by Mongodb should be:

{"$expr": {"$lt": ["$next_sms_time", "$last_sms_time"]}}

or with $where:

{"$where": "this.next_sms_time < this.last_sms_time"}

To Reproduce
Sorry I will complete the sample later.

Expected behavior
See above.

Additional context
Nothing.

Copy link
Contributor

github-actions bot commented Aug 2, 2024

This issue is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the Stale label Aug 2, 2024
Copy link
Contributor

This issue was closed because it has been stalled for 14 days with no activity.

@adeelsohailahmed adeelsohailahmed added bug Something isn't working and removed Stale labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants