pouchdb-find + $in : no matching index found

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



pouchdb-find + $in : no matching index found



I have a secondary non-unique key named 'tileId' which I would like to use for searching. Therefore, I have created the following index:


this.pouchDB.createIndex(
index:
fields: ['tileId']

);



Then it works fine when I'm using the following selector:


selector: tileId: 1234567



But when I try to search for a list of values with the following selector, it works but gives a warning about no matching index found:


selector: tileId: $in, [1234567, 2345678]



Finally, I want to add several more similar fields to this query to get something like this:


selector: tileId: $in, [1234567, 2345678],
category: $in, [list of categories],
subcategory: $in, [list of subcategories]



Is it doable, and how?




1 Answer
1



As I understand it, the current implementation of PouchDB Find only utilizes an index for contiguous keys (tileId values in this case). If you specify a query which interrogates a disparate set of records by tileId e.g. using an $or or $in clause, the (very basic) query planner elects not to use tileId as the basis for an index scan at all.


tileId


tileId


$or


$in


tileId



I think you'd be better off issuing multiple queries rather than using $in for the tileId. The additional filters maybe relatively cheap if the number of documents with the specified tileId is modest.


$in


tileId


tileId





Ok, thanks for the answer. Though, I was expecting that since they have this '$in' qualifier, there should be a way to use it gracefully. How do think, Is there a way to get it working via map/reduce API?
– Anton Pilyak
Aug 7 at 16:13






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS