-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from seangarner/case-insensitive-eq
support for case insensitive matching
- Loading branch information
Showing
5 changed files
with
175 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,25 @@ contains | `contains(borough, "shire")` | |
The extra operators also support `$not`. For example `not(contains(borough, "shire"))` would | ||
find the docs in which `borough` does not contain `shire`. | ||
|
||
#### case insensitive matching | ||
Some operators support the `i` flag to denote that the operator should match the value case | ||
insensitively. This is useful if you want to enable case insensitive match without allowing | ||
full `$regex` powers (because `$regex` is the only way of achieving this in mongo). | ||
|
||
- `eq(tags, 'NODE', i)` matches Node, NODE, node, NoDe, etc | ||
|
||
Also supported with `ne`, `startsWith`, `endsWith` and `contains`, but must be enabled using the | ||
`disabledOperators` query option as the default is to disable this feature. | ||
|
||
```js | ||
var options = { | ||
query: { | ||
caseInsensitiveOperators: true | ||
} | ||
}; | ||
mongoUrlUtils({query: 'regex(email,"[email protected]",i)'}, options); | ||
``` | ||
|
||
#### mongo types | ||
The `type()` query operator allows either integer identifiers as per the mongodb documentation. For | ||
convinience it also maps the following types to their ids: `Double`, `String`, `Object`, `Array`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters