Created
December 28, 2017 05:09
-
-
Save kevinjqiu/9d74befc20e60826a4c34c6b4a971812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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