Skip to content

ShaDowMak/fastify-mongoose

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastify-mongodb

js-standard-style

Under the hood mongoose ODM is used, the options that you pass to register will be passed to the Mongoose connection. Pass the uri option is required.

Install

npm i fastify-mongoose --save

Usage

Add it to you project with register and you are done!
You can access the Mongoose Connection via fastify.mongo.db and ObjectId via fastify.mongo.ObjectId.

const fastify = require('fastify')

fastify.register(require('fastify-mongoose'), {
  uri: 'mongodb://localhost/test_db'
}, err => {
  if (err) throw err
})

fastify.listen(3000, err => {
  if (err) throw err
  console.log(`server listening on ${fastify.server.address().port}`)
})

License

Licensed under MIT.

About

Fastify Mongoose plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%