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 5 years ago
  • Reactions: 1
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Fix merged.

From what I can tell, this PR has not been integrated into the 7.3.x branch. I installed a few 7.3.1 versions on my local environment and could not find the modifications that this PR brings.

Its the same error in 7.3.1 -> userValue.every is not a function It’s definitely not in release or it’s not really fixed.

Why is the fix not in the release? => https://pouchdb.com/2022/11/11/pouchdb-7.3.1.html