pouchdb icon indicating copy to clipboard operation
pouchdb copied to clipboard

$or with $regex broken after 7.2.2 -> 7.3.0

Open JanGoerss opened this issue 2 years ago • 3 comments

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

JanGoerss avatar Apr 21 '22 05:04 JanGoerss

I have the fix ready for this. I need to write the unit tests and send the PR.

filionf avatar Apr 23 '22 10:04 filionf

@filionf looks like there was a build error on your PR. Is this something that can be sorted - seems simple enough as it's largely a linting error

pete-hotchkiss avatar Jun 20 '22 19:06 pete-hotchkiss

From what I can see, the latest build went through. What seems to be missing is a reviewer. https://github.com/pouchdb/pouchdb/pull/8493

filionf avatar Jun 20 '22 19:06 filionf

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Aug 20 '22 02:08 github-actions[bot]

This is still an issue. #8493 needs to be merged.

maxnowack avatar Aug 20 '22 09:08 maxnowack

Fix merged.

garethbowen avatar Aug 22 '22 19:08 garethbowen

When new version will be available ?

gwen1230 avatar Aug 24 '22 14:08 gwen1230

When this fix will be available ?

gwen1230 avatar Oct 04 '22 07:10 gwen1230

@garethbowen do we have an ETA for when this can be released.

Even if we get a patch out for it?

pete-hotchkiss avatar Nov 07 '22 19:11 pete-hotchkiss

I'm not planning a release. I suggest reaching out on Slack.

garethbowen avatar Nov 07 '22 22:11 garethbowen

@garethbowen ok. I cant seem to find details of the slack channel. Is that something you can post at all ?

pete-hotchkiss avatar Nov 08 '22 07:11 pete-hotchkiss

@pete-hotchkiss Good point... Join the couchdb Slack here: https://join.slack.com/t/couchdb/shared_invite/zt-fa9zim0j-H04m4o_KcLdWeOxEAcwM8g

Then there's a #pouchdb channel. The community is more active there than here.

The pouchdb website should also be updated to include this info...

garethbowen avatar Nov 08 '22 21:11 garethbowen

This has been released now, thanks for the heads-up: https://pouchdb.com/2022/11/11/pouchdb-7.3.1.html

janl avatar Nov 11 '22 15:11 janl

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

JanGoerss avatar Nov 14 '22 13:11 JanGoerss

@JanGoerss is it perhaps just a case of it not making the release notes. Personally - I haven't had a chance to run any tests yet to tell.

But from what I can tell - the code for the fix is in the main/master branch

pete-hotchkiss avatar Nov 14 '22 18:11 pete-hotchkiss

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.

JanGoerss avatar Nov 15 '22 05:11 JanGoerss

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.

filionf avatar Nov 15 '22 21:11 filionf