# docci-db

> A document based Node.js DB

Latest version **0.0.8** (published 2021-03-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install docci-db
pnpm add docci-db
yarn add docci-db
bun add docci-db
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2021-03-12 |
| First published | 2021-03-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Author | Pontus Espe |
| Maintainers | pontus.espe |

## Links

- npm: https://www.npmjs.com/package/docci-db
- npm.io page: https://npm.io/package/docci-db

## Dependencies (2)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [validate.js](https://npm.io/package/validate.js.md) ^0.13.1

## Recent versions

- 0.0.8 (latest) — 2021-03-12
- 0.0.7 — 2021-03-12
- 0.0.6 — 2021-03-12
- 0.0.5 — 2021-03-12
- 0.0.4 — 2021-03-12
- 0.0.3 — 2021-03-12
- 0.0.2 — 2021-03-12
- 0.0.1 — 2021-03-12

## README

![alt text](https://i.imgur.com/jg1TvKK.png "DocciDB Logo")

Very fast, simplistic NoSQL database. Build and ready for your Node.js application.

## Installation

Use the package manager NPM to install DocciDB.

```bash
npm install docci-db
```
## Setting up model schemes
In your project root you will need to create a folder ./models/. In this folder you will place all of your collections & schemes. For validations DocciDB uses [Validate.js](https://validatejs.org/). Here is an example of how:

**/models/books.js**
```javascript
const books = {
    "name": {
        presence: true,
        type:'string'
    },
    "pages": {
        presence: true,
        type: "number"
    },
}

module.exports = books;
```

## Communcating
To fetch, delete and update docuements in your DocciDB you can call the following functions.

**getAll() - Fetching all the doucuments**
```javascript
const fetchAllBooks = await db.books.getAll();
```

**get() - Fetches one document**
```javascript
const fetchAllBooks = await db.books.get(_id);
```

**create() - Creates on document**
```javascript
const createdBook = await db.books.create({"name":"Hunger Games", "pages":516});
```

**update() - Updates one document**
```javascript
const updatedBook = await db.books.update({"_id":"ceda09d7-fa2c-4058-a020-911f82af2a1b","name":"Hunger Games", "pages":516});
```

**delete() - Deletes on document**
```javascript
const deletedBook = await db.books.delete(_id);
```

**clear() - Deletes all of the documents in a collection**
```javascript
await db.books.clear();
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

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