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

Regexes are not supported in $all queries #190

Closed
pypmannetjies opened this issue Aug 20, 2021 · 6 comments
Closed

Regexes are not supported in $all queries #190

pypmannetjies opened this issue Aug 20, 2021 · 6 comments
Labels

Comments

@pypmannetjies
Copy link

pypmannetjies commented Aug 20, 2021

It appears that RegExp are not supported in $all queries when using Mingo, but they are in MongoDB

Opened a PR with a new test to show the issue: #189

@kofrasa
Copy link
Owner

kofrasa commented Aug 21, 2021

Thanks for opening an issue.

I interpret the above as saying that; regexes are supported when using the $all operator in mingo but not in MongoDB. This means the behaviour in mingo is not correct and your PR confirms that is the case.

Unfortunately, this library is not implemented according to a spec, and such inconsistencies do exists. This is one of such that cannot be fix since doing so can break existing users depending on the behaviour. Also, it seems desirable that regexes work under $all so I inclined to believe users will prefer this behaviour.

I will add a section to the readme to document such differences in a future update.

@pypmannetjies
Copy link
Author

pypmannetjies commented Aug 22, 2021

Thanks for opening an issue.

I interpret the above as saying that; regexes are supported when using the $all operator in mingo but not in MongoDB. This means the behaviour in mingo is not correct and your PR confirms that is the case.

Unfortunately, this library is not implemented according to a spec, and such inconsistencies do exists. This is one of such that cannot be fix since doing so can break existing users depending on the behaviour. Also, it seems desirable that regexes work under $all so I inclined to believe users will prefer this behaviour.

I will add a section to the readme to document such differences in a future update.

Hmmm no I am reporting that Regexes are NOT supported when using the $all operator in mingo, but they ARE supported in MongoDB. So I assumed this is an error in Mingo that could be fixed. I'll edit my issue description to be more clear.

@kofrasa
Copy link
Owner

kofrasa commented Aug 22, 2021

The test in #189 is passing which suggest regexes are supported in $all.

Can you provide an example from MongoDB that would not work in mingo?

@pypmannetjies
Copy link
Author

The test in #189 is passing which suggest regexes are supported in $all.

Can you provide an example from MongoDB that would not work in mingo?

Apologies but I can't see where the tests passed in that PR, I see a https://lgtm.com/projects/g/kofrasa/mingo/rev/pr-5c21c72550d61fb694e6053b90023e3910298c8d LGTM page but not where the tests are running.

Locally, this test fails for me.

@kofrasa
Copy link
Owner

kofrasa commented Aug 24, 2021

My bad, I wrongly assumed the status checks also includes the unit test execution status. I should set that up sometime.

I will mark this as a bug. Please feel free to send a PR. Will be very much appreciated.

@kofrasa kofrasa added the bug label Aug 24, 2021
@pypmannetjies
Copy link
Author

My bad, I wrongly assumed the status checks also includes the unit test execution status. I should set that up sometime.

I will mark this as a bug. Please feel free to send a PR. Will be very much appreciated.

Thank you! I pushed a potential fix to my PR

Added some additional tests, and they are passing fine. I'm not super familiar with this project so please LMK if this is not the right approach for the fix.

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

No branches or pull requests

2 participants