# @jessedp/nedb-async

> Promise wrapper for Nedb that makes it possible to use all Nedb all cursor modifiers.

Latest version **0.1.3-c** (published 2019-11-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jessedp/nedb-async
pnpm add @jessedp/nedb-async
yarn add @jessedp/nedb-async
bun add @jessedp/nedb-async
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3-c |
| Published | 2019-11-13 |
| First published | 2019-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Akuma Isaac Akuma |
| Maintainers | jessedp |
| Keywords | nedb, promise, async, await, javascript, database, electron, nw.js, node |

## Links

- npm: https://www.npmjs.com/package/@jessedp/nedb-async
- Repository: https://github.com/Akumzy/nedb-async
- Homepage: https://github.com/Akumzy/nedb-async#readme
- Issues: https://github.com/Akumzy/nedb-async/issues
- npm.io page: https://npm.io/package/@jessedp/nedb-async

## Dependencies (1)

- [nedb](https://npm.io/package/nedb.md) ^1.8.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.1.3-c (latest) — 2019-11-13
- 0.1.3-b — 2019-11-12
- 0.1.3-a — 2019-11-11
- 0.1.3 — 2019-11-11
- 0.1.2-a — 2019-11-11
- 0.1.2 — 2019-11-11

## README

# Nedb-Async

**nedb-async is a simply promise base wrapper methods for <a href="https://github.com/louischatriot/nedb">Nedb</a>**

## Installation
Install with npm
```bash
  npm install nedb-async
```
or with yarn
```bash
  yarn add nedb-async
```

## Usage

It is very simple and to avoid too much complexity all the cursor modifiers for
`find, findOne and count`
methods has to be pass as the last argument in an array.

---

**Very important to know that all the promise base methods starts with async then the method name in camel casing**

- `asyncFind`
- `asyncFindOne`
- `asyncCount`
- `asyncInsert`
- `asyncUpdate`
- `asyncRemove`
- `asyncEnsureIndex`
- `asyncRemoveIndex`

and every other ned`b origin methods are still available.

## Usage:

```js
db.asyncFind({}, [['sort', { name: -1 }], ['limit', 2]])
  .then(function(docs) {})
  .catch(function(error) {})
//Or with async await
async function getUsers() {
  let users = await db.asyncFind({}, [['limit', 100]])
}

async function countAllUsers() {
  let users = await db.asyncCount({})
}
```

For Nodejs

```js
const DB = require('nedb-async')

const data = new Nedb({
  filename: 'data.db',
  autoload: true,
})
```

## Typescript

For typescript users conceder using this approach for better types support

```ts
import Nedb from 'nedb-async'

interface IUser {
  firstName: string
  lastName: string
  age: number
  email: string
}

const User = new Nedb<IUser>({ filename: 'data.db', autoload: true })
```

Please use the official <a href="https://github.com/louischatriot/nedb">Nedb</a> documentation for more information.

## Licence

MIT

---
_Source: https://npm.io/package/@jessedp/nedb-async · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
