Skip to content

Instantly share code, notes, and snippets.

@sudikrt
Created August 2, 2017 13:12
Show Gist options
  • Save sudikrt/44b3da0a928ad68dde7335b9cc8efde6 to your computer and use it in GitHub Desktop.
Save sudikrt/44b3da0a928ad68dde7335b9cc8efde6 to your computer and use it in GitHub Desktop.
loki js find ()
app.post('/find', async (req, res) => {
var lokiDbRef = new Loki(`${DB_PATH}/${DB_NAME}`, { persistenceMethod: 'fs' });
var col = await loadCollection(COLLECTION_NAME, lokiDbRef);
var result = col.find({ isActive: true });
res.send({ 'success': true, 'data': result, 'length': col.find({ isActive: true }).length });
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment