-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix for Equals Expression and tolower OData function #11
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,7 +220,8 @@ export class Visitor{ | |
this.Visit(node.value.left, context); | ||
this.Visit(node.value.right, context); | ||
|
||
if (context.identifier) context.query[context.identifier] = context.literal; | ||
// using object with $eq instead of just value assigned to identifier we resolve an issue with OData: not (documentStatus eq 'OPEN') | ||
if (context.identifier) context.query[context.identifier] = { $eq: context.literal }; | ||
delete context.identifier; | ||
delete context.literal; | ||
} | ||
|
@@ -288,6 +289,12 @@ export class Visitor{ | |
case "startswith": | ||
context.query[context.identifier] = new RegExp("^" + context.literal, "gi"); | ||
break; | ||
case "tolower": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have any plans to add a test case for this? |
||
// mongoDb is case insensitive as default, so it should resolve 99% cases I hope - better than exception I think? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove "I hope - better than exception I think?" I think we agree 😃 |
||
// $toLower function is implemented only for agregation in MongoDb | ||
// using object with $eq instead of just value assigned to identifier we resolve an issue with OData: not (documentStatus eq 'OPEN') | ||
context.query[context.identifier] = { $eq: context.literal }; | ||
break; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these indent issues? |
||
default: | ||
throw new Error("Method call not implemented.") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the not (...) test case ensures we do not regress back and break your feature.