1.0.1 • Published 4 years ago

fastify-mongoose-connection v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Fastify Mongoose Connection

this package add a db property in fastify object a fastify decorator workks.

How to install

npm i fastify-mongoose-connection

How to access connection

const fastify = require('fastify')
 
fastify.register(require('fastify-mongoose-connection'), config)

this will add a db property to fastify

fastify.db.users.find({});

Configuration properties

{
    user: 'root', //database user
    password: 'example', // database password
    name: 'test', //database name
    hosts: [{
        host: 'localhost', // host for a database server
        port: 27017, // port of databaser server
    }],
    options: {} // same as mentioned in mongoose documentation
}

License

MIT