fastify-mongoose-connection

1.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i fastify-mongoose-connection

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

59.7 kB

Total Files

33

Last publish

Collaborators

  • sonsor