pouchdb: $or with $regex broken after 7.2.2 -> 7.3.0

Issue

BugFix 0e27e23f (#8222) - fix multiple $regex conditions on same field when using $and

has implement error with $or and $regex

Error => userValue.every is not a function

in

  '$regex': function (doc, userValue, parsedField, docFieldValue) {
    return fieldExists(docFieldValue) &&
      typeof docFieldValue == "string" &&
      userValue.every(function (regexValue) {
        return regexMatch(docFieldValue, regexValue);
      });
  },

with Selector

{
	"$and": [
		{
			"$or": [
				{
					"field1": {
						"$regex": "/searchtext/i"
					}
				},
				{
					"field2": {
						"$regex": "/searchtext/i"
					}
				},
				{
					"field3": {
						"$regex": "/searchtext/i"
					}
				},
				{
					"field4": {
						"$regex": "/searchtext/i"
					}
				}
			]
		},
		{
			"fieldA": {
				"$exists": true
			},
			"fieldB": {
				"$exists": true
			}
		}
	]
}

Info

  • Environment: Browser
  • Platform: all
  • Adapter: indexeddb
  • Server: CouchDB

Reproduce

see up

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Fix merged.