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
- Host: GitHub
- URL: https://github.com/abdullah-bl/electron-nedb
- Owner: abdullah-bl
- License: mit
- Created: 2020-03-09T05:22:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T17:31:35.000Z (over 3 years ago)
- Last Synced: 2024-05-28T15:53:58.296Z (about 2 years ago)
- Topics: electron, electron-app, nedb, nedb-promises, storage, store
- Language: JavaScript
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
}
```