I can't get the pouchdb-find plugin to work. The closest I can get is a 'find is not a function' exception.
I tried the approach from here, but it doesn't help
I also tried to use pouchdb-find with pouchdb-browser.
Below is the problematic code that I have currently. The PouchDB module itself won't work without adding the .default at the end of the require. Note that I did already populate a database with data prior to attempting to use .find().
// npm install --save pouchdb
// npm install --save pouchdb-find
const PouchDB = require('pouchdb').default;
PouchDB.plugin(require('pouchdb-find'));
const db = new PouchDB(dbName);
db.find({
limit: 100
});
I'm open to any solution that allows me to use the pouchdb-find plugin.
The solution was to mimic the way I was requiring PouchDB. (Also, the object passed to find() creates an error because it's supposed to have a selector, but that's not really relevant to the question's topic)
PouchDB.plugin(require('pouchdb-find').default);