pouchdb / pouchdb-server

CouchDB-compatible server built on PouchDB and Node
Apache License 2.0
944 stars 155 forks source link

Case-insensitive regex queries #445

Open muety opened 3 years ago

muety commented 3 years ago

I might be doing something wrong here, but it looks like $regex queries can't be made case-insensitive. Consider the following example.

{
  "selector": {
    "title": {
      "$regexp": "Bar"
    }
}

Having a document with { "title": "Foo Bar Baz" }, the above query will succeed and return the document. However, I'd still like to find it if my regex was bar (lower case).

Using (?i)bar as a regex yield the following error:

Invalid regular expression: /(?i)bar/: Invalid group