I have something like a blog where each doc has comments, which have a user, date, body, ... I'd like to find all docs which have a comment written by a specific user (or at a specific date, does not really matter).
Unfortunately I get an error:
Error: unknown operator "0" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type or $all
at match (/path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:122:11)
Maybe I'm doing something wrong? It's very very similar to nolanlawson/pouchdb-find#118, but it should have been resolved a long time ago. I'm not (yet) using an index, but as I understand the problem it should not matter.
I'm using pouchdb-find via npm, version 0.10.5 (current).
I've written a small script which initializes a database with some docs and runs the query:
https://gist.github.com/plepe/44c5f2dfd210c695b4cb4ddb6b254ec8
It fails with the following stack trace:
/path/to/script/testfind.js:47
if (err) { throw(err) }
^
Error: unknown operator "0" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type or $all
at match (/path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:122:11)
at /path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:97:12
at Array.every (native)
at matchSelector (/path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:95:31)
at /path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:81:12
at Array.every (native)
at rowFilter (/path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:69:25)
at /path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:220:16
at Array.some (native)
at Object.$elemMatch (/path/to/script/node_modules/pouchdb-find/lib/adapters/local/find/in-memory-filter.js:219:28)
Have you tested by any chance to see if Cloudant/Couch2 has the same issue? We try to match their behavior exactly.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@nolanlawson I meet the same issue as @plepe said. I tried my code by Couchdb2 and it works, however the same query by pouchdb throws error.
Most helpful comment
@nolanlawson I meet the same issue as @plepe said. I tried my code by Couchdb2 and it works, however the same query by pouchdb throws error.