0.3.0 • Published 5 years ago

fastify-mongoose v0.3.0

Weekly downloads
194
License
MIT
Repository
github
Last release
5 years ago

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'
})

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

"version": "0.3.0 and above plugin have ability to open connection with multiple different databases, for achieving this functionality it have to stop using default mongoose connection. Onward please use db client returned by this plugin.

License

Licensed under MIT.

0.3.0

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago