An open API service indexing awesome lists of open source software.

https://github.com/abdullah-bl/electron-nedb

Simple way to use nedb in your electron app
https://github.com/abdullah-bl/electron-nedb

electron electron-app nedb nedb-promises storage store

Last synced: about 1 month ago
JSON representation

Simple way to use nedb in your electron app

Awesome Lists containing this project

README

          

using [nedb](https://github.com/louischatriot/nedb#readme) in your electron app.

Check out the [docs](https://github.com/bajankristof/nedb-promises/blob/master/docs.md).

### Installation
```sh
yarn add https://github.com/abdullah-bl/electron-nedb
```

```js
const Collection = require('electron-nedb')

let options = {} // nedb options https://github.com/louischatriot/nedb#creatingloading-a-database
let data = Collection('users', options)

// #1
data.find({ field: true })
.then(...)
.catch(...)

// #2
data.find({ field: true })
.exec(...)
.then(...)
.catch(...)

// #1 and #2 are equivalent

data.findOne({ field: true })
.then(...)
.catch(...)

data.insert({ doc: 'yourdoc' })
.then(...)
.catch(...)

// or in an async function
async function findSorted(page, perPage = 10) {
return await data.find(...)
.sort(...)
.limit(perPage)
.skip(page * perPage)
}
```