davidgtonge / underscore-query

MongoDB like query api for JavaScript Arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support $regex being defined by string/options

megawac opened this issue · comments

I'm planning to use $regex to filter a collection on a client and a server. For ease of use transfer (JSON encoding) I wanted to use the <field>: {$regex: '<str>', $options: '<flags>} format described here [1]. Underscore-query should construct the regexp in these cases.

[1] https://docs.mongodb.com/manual/reference/operator/query/regex/

@megawac here is the functionality in query-predicate: davidgtonge/query-predicate@1f0cb86

The code is extreme point-free, but I like the separation of the parser and the query runner.