this package add a db property in fastify object a fastify decorator workks.
npm i fastify-mongoose-connection
const fastify = require('fastify')
fastify.register(require('fastify-mongoose-connection'), config)
this will add a db property to fastify
fastify.db.users.find({});
{
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
}
MIT