Skip to content

abdullah-bl/electron-nedb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

using nedb in your electron app.

Check out the docs.

Installation

yarn add https://github.com/abdullah-bl/electron-nedb
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)
}

Releases

No releases published

Packages

No packages published