Skip to content

Commit

Permalink
[ci-skip] Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
allevo committed Aug 5, 2017
1 parent 0fd4456 commit e73ffd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
CRUD wrapper around mongodb library

## Install
```
```sh
npm i --save mongodbcrud
```

## Usage
```
```js
const MongoClient = require('mongodb').MongoClient
MongoClient.connect(url)
.then(db => {
Expand All @@ -21,7 +21,7 @@ MongoClient.connect(url)
```

## Api
```
```js
mongodbCrud.findOne(collectionName, query, options)
mongodbCrud.findOneAndUpdate(collectionName, filter, updateQuery, options)
mongodbCrud.upsertOne(collectionName, filter, updateQuery, options)
Expand All @@ -32,6 +32,8 @@ mongodbCrud.createCollection(collectionName, options)
```
Each method has the collection name as first parameter. The other parameters follow the `mongodb` library means.

All methods return promises.

## Why
Using `mongodb` library, some checks should be done anyway. For example `Collection.findOne` method doesn't throw error if document is not found.
This library aims to correct this behaviour without make any logic layer between your code and `mongodb` library.

0 comments on commit e73ffd8

Please sign in to comment.