Skip to content

Commit

Permalink
Adds travis + updates README
Browse files Browse the repository at this point in the history
  • Loading branch information
lependu committed Aug 14, 2018
1 parent 088ec2c commit 74da028
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
language: node_js

node_js:
- "10"
- "8"
- "6"

script: standard && tap test.js

services:
- mongodb

notifications:
email:
on_success: never
on_failure: never
22 changes: 12 additions & 10 deletions README.md
@@ -1,6 +1,6 @@
# fastify-mongojs

Simple wrapper around (mongojs)[https://github.com/mafintosh/mongojs] to share common connection pool across (Fastify)[https://github.com/fastify/fastify] server.
Simple wrapper around [mongojs](https://github.com/mafintosh/mongojs) to share common connection pool across [Fastify](https://github.com/fastify/fastify) server.

[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
[![Build Status](https://travis-ci.org/lependu/fastify-mongojs.svg?branch=master)](https://travis-ci.org/lependu/fastify-mongojs)
Expand Down Expand Up @@ -35,17 +35,19 @@ $ npm i --save fastify-mongojs
```

## Reference
`name` `{String}` `optional` `default: 'mongo'`
`url` `{String}` `required`
`collections` `{Array}` `optional` `default: []`

name | type | required | default
-----|------|----------|---------
**`name`** | `{String}` | :x: | `'mongo'`
**`url`** | `{String}` | :heavy_check_mark: |
**`collections`** | `{Array}` | :x: | `[]`

The only plugin specific option is `name` which makes possible to share multiple connection pools across the server instance.
The `url` and `collections` options will be passed to mongojs separately, all other options will be passed to the mongojs instance as well.
For more information about the avaiable options please see (mongojs)[https://github.com/mafintosh/mongojs]

For more information about the avaiable options please see [mongojs](https://github.com/mafintosh/mongojs).
## Caveats
Due the recent changes in (mongodb)[https://github.com/mongodb/node-mongodb-native] if you pass mongodb connection to mongojs it will fail.
There is a (PR)[https://github.com/mafintosh/mongojs/pull/353] in place which needs to be published first, to imlement this feature.

Due the recent changes in [mongodb](https://github.com/mongodb/node-mongodb-native) if you pass mongodb connection to mongojs it will fail.
There is a [PR](https://github.com/mafintosh/mongojs/pull/353) in place which needs to be published first, to imlement this feature.
## License
Licensed under [MIT](./LICENSE).
2 changes: 1 addition & 1 deletion test.js
Expand Up @@ -7,7 +7,7 @@ const { test } = tap
test('Decorates fastify instance with db | without name', t => {
t.plan(4)

register(t, { url: 'db', collections: ['a']}, function (err, fastify) {
register(t, { url: 'db', collections: ['a'] }, function (err, fastify) {
t.error(err)
t.equal(typeof fastify.mongo, 'object')

Expand Down

0 comments on commit 74da028

Please sign in to comment.