# kunlatek-crud

> Generic CRUD entending to cover many sql ad nosql databases most simple processes with one syntax

Latest version **0.1.2** (published 2020-05-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install kunlatek-crud
pnpm add kunlatek-crud
yarn add kunlatek-crud
bun add kunlatek-crud
```

## 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.1.2 |
| Published | 2020-05-03 |
| First published | 2020-05-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 32 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | Kunlatek |
| Maintainers | kunlatek |

## Links

- npm: https://www.npmjs.com/package/kunlatek-crud
- npm.io page: https://npm.io/package/kunlatek-crud

## Dependencies (1)

- [mongoose](https://npm.io/package/mongoose.md) ^5.9.11

## Recent versions

- 0.1.2 (latest) — 2020-05-03
- 0.1.1 — 2020-05-03
- 0.0.1 — 2020-05-02

## README

#[KUNLATEK-CRUD](https://gitlab.com/kunlatek-quickstart/nodejs/packages/crud)
> Generic CRUD entending to cover many sql ad nosql databases most simple processes with same POJO

##Installing
```
npm install --save kunlatek-crud@latest
```

##Last updates
- Dealing with basic mongodb queries
- Fixed returning mongodb queries

##Using Kunlatek CRUD
###Create
```
const create = require('kunlatek-crud');

const queryParams = {
    entity: 'user',
    method: 'create',
    object: {
        username: 'testingUsername',
        password: 'testingassword',
        email:'testing@email.com',
        emailVerified: 1,
        inviter: 'testingInviter'
    }
};

const connectionParams = {
    connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
    databaseName: 'mongodb'
}

create.crud(queryParams, connectionParams);
```

###Read
```
const read = require('../index');

const queryParams = {
    entity: 'user',
    method: 'read',
    conditions: {
        username: 'testingUsername'
    }
};

const connectionParams = {
    connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
    databaseName: 'mongodb'
}

read.crud(queryParams, connectionParams);
```

###Update
```
const update = require('../index');

const queryParams = {
    entity: 'user',
    method: 'update',
    conditions: {
        username: 'testingUsername'
    },
    object: {
        password: 'newPassword',
    }
};

const connectionParams = {
    connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
    databaseName: 'mongodb'
}

update.crud(queryParams, connectionParams);
```

###Delete
```
const deleteMethod = require('../index');

const queryParams = {
    entity: 'user',
    method: 'hardDelete',
    conditions: {
        username: 'testingUsername'
    }
};

const connectionParams = {
    connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
    databaseName: 'mongodb'
}

deleteMethod.crud(queryParams, connectionParams);
```

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