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

Add support for $expr #79

Closed
felipecarrillo100 opened this issue Apr 5, 2018 · 2 comments
Closed

Add support for $expr #79

felipecarrillo100 opened this issue Apr 5, 2018 · 2 comments

Comments

@felipecarrillo100
Copy link

mingo.zip

I have modified the mingo.js from the distribution directory to support the $expr operator.

This operator is introduced in Mongo 3.6 and it allows to use expression (such as arithmetic operations) in a query. It also allows comparing 2 fields against eachothr.

Example:
{"$expr":{"$gt":[{"$multiply":["$value1", 2]}, "$value2"]}}

The "$expr" offers advantages over "$where" and it seems easy to implement from the building blocs already available in your implementation. I just had to modify a few lines (Do find "$expr").

I'm not sure how to build the project but it would be great if you can add this feature. Use the code in my attachment as reference.

Thanks in advance

@kofrasa
Copy link
Owner

kofrasa commented Apr 10, 2018

Thanks for the contribution @felipecarrillo100 I will take a look at this soon.

@kofrasa
Copy link
Owner

kofrasa commented Apr 13, 2018

Added in commit 4a75f03

This will be going in the 2.2.1 release. You can play around with the changes in branch:development

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

No branches or pull requests

2 participants