Skip to content

Instantly share code, notes, and snippets.

@kevinjqiu
Created December 28, 2017 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinjqiu/9d74befc20e60826a4c34c6b4a971812 to your computer and use it in GitHub Desktop.
Save kevinjqiu/9d74befc20e60826a4c34c6b4a971812 to your computer and use it in GitHub Desktop.
var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-find'));
db = new PouchDB("test");
db.createIndex({
index: {
fields: ['metadata.type']
}
});
db.createIndex({
index: {
fields: ['date']
}
});
query = async () => {
return await db.find({
selector: {
"metadata.type": "Transaction"
},
sort: ["date"]
});
}
try {
query();
} catch(err) {
console.log(err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment