diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5020868 --- /dev/null +++ b/.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 diff --git a/README.md b/README.md index e84b722..95d858b 100644 --- a/README.md +++ b/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) @@ -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). diff --git a/test.js b/test.js index bfd5154..851b59b 100644 --- a/test.js +++ b/test.js @@ -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')