# crud-sdk

> A microservice that can be used by other applications to perform all CRUD operations for MongoDB.

Latest version **1.0.14** (published 2019-12-09) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.14 |
| Published | 2019-12-09 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.9.0 |
| Dependencies | 3 |
| Unpacked size | 135.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Girijashankar Mishra |
| Maintainers | shank007 |
| Keywords | create, update, readById, readByCondition, delete, sort, aggregate, limit |

## Links

- npm: https://www.npmjs.com/package/crud-sdk
- Repository: https://github.com/shank007/crud-sdk
- Homepage: https://github.com/shank007/crud-sdk#readme
- Issues: https://github.com/shank007/crud-sdk/issues
- npm.io page: https://npm.io/package/crud-sdk

## Dependencies (3)

- [chai](https://npm.io/package/chai.md) ^4.1.2
- [mongodb](https://npm.io/package/mongodb.md) ^2.0
- [mongoskin](https://npm.io/package/mongoskin.md) ^2.0.3

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.14 (latest) — 2019-12-09
- 1.0.13 — 2019-12-09
- 1.0.12 — 2019-10-22
- 1.0.11 — 2019-09-17
- 1.0.10 — 2019-09-17
- 1.0.9 — 2019-09-17
- 1.0.8 — 2019-09-17
- 1.0.7 — 2019-09-17
- 1.0.6 — 2019-09-17
- 1.0.5 — 2019-09-17
- 1.0.4 — 2019-09-17
- 1.0.3 — 2019-08-22
- 1.0.2 — 2019-08-20
- 1.0.1 — 2019-08-20
- 1.0.0 — 2019-08-20
- … 25 more at https://npm.io/package/crud-sdk/versions

## README

# crud-sdk
A microservice that can be used by other applications to perform all CRUD operations for MongoDB.

## SDK for developers
The crud-sdk helps developers to perform create, read, update, delete operations on MongoDB for any application.

## Deployment
The project is hosted on GitHub. 

### Prerequisites
Make sure you have Node.js 8.9.0 or higher installed. If not, install it.

```sh
# Check your node version using this command
node --version
```
```sh
# Access the SDK using below command within the project directory
npm install crud-sdk

# To save and install the SDK in your application package.json use below command within the project directory.
npm install -S crud-sdk
```
## How to pass connectionString and dbName to crud-sdk 
connectionString="connection-string" dbName="db-name" node server-file-name

## How to use crud-sdk
```sh
var crud = require('crud-sdk');

# Create (Store data in MongoDB)
crud.create( <collection-name>, {DATA in JSON Format}, function (err, data) {
            if (err) // do something
});

# Update (Update already data stored in MongoDB)
crud.update( <collection-name>, {Field/Data to be updated in JSON}, {Update Condition in JSON}, function (err, result) {
            if (err) // do something
});

# UpdateById (Update already data stored in MongoDB using MongoId)
crud.updateById( <collection-name>, {Field/Data to be updated in JSON}, <mongo-objectId>, function (err, result) {
            if (err) // do something
});

# UpdateMultiple (Update multiple records that are already data stored in MongoDB)
crud.updateMultiple( <collection-name>, {Field/Data to be updated in JSON}, {Update Condition in JSON}, function (err, result) {
            if (err) // do something
});

# Delete (Delete a data from MongoDB)
crud.delete( <collection-name>, {Delete Condition in JSON}, function (err, result) {
            if (err) // do something
});

# DeleteById (Delete a data from MongoDB using MongoId)
crud.deleteById( <collection-name>, <mongo-objectId>, function (err, result) {
            if (err) // do something
});

#ReadById (Read Data from MongoDB using Mongo ObjectId)
crud.readById( <collection-name>, <mongo-objectId>, {Params Condition in JSON Format}, function (err, result) {
            if (err) // do something
});

#ReadByCondition (Read Data from MongoDB using condition)
crud.readByCondition( <collection-name>, {Read Condition in JSON Format},{Params Condition in JSON Format}, function (err, result) {
            if (err) // do something
});

#ReadByMultipleConditions (Read Data from MongoDB using multiple condition)
crud.readByMultipleConditions( <collection-name>, {Read Condition1 in JSON Format}, {Read Condition2 in JSON Format},{Params Condition in JSON Format}, function (err, result) {
            if (err) // do something
});

#ReadAll (Read All Data from MongoDB for a collection)
crud.readByCondition( <collection-name>, {}, function (err, result) {
            if (err) // do something
});

#Sort (Read and Sort Data from MongoDB using condition)
crud.sort( <collection-name>, {Read Condition in JSON Format}, { Sort Condition in JSON Format }, {Params Condition in JSON Format}, function (err, result) {
            if (err) // do something
});

#SortByLimit (Read and Sort Data based on limit from MongoDB using condition)
crud.sortByLimit( <collection-name>, {Read Condition in JSON Format}, { Sort Condition in JSON Format }, <skip-in-numbers>, <limit-in-numbers>, {Params Condition in JSON Format}, function (err, result) {
            if (err) // do something
});

#Aggregate (Read and Aggregate Data from MongoDB to process data records and return computed results.)
crud.aggregate( <collection-name>,  <aggregate-condition>, function (err, result) {
            if (err) // do something
});

#Limit (Read and Limit Data from MongoDB using condition)
crud.limit( <collection-name>, {Read Condition in JSON Format}, <skip-in-numbers>, <limit-in-numbers>, {Params Condition in JSON Format}, function (err, result) {
            if (err) // do something
});
```

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