Home

Awesome

Fortune MongoDB Adapter

Build Status npm Version License

This is a MongoDB adapter for Fortune. It uses the official Node.js MongoDB driver internally.

Usage

Install the fortune-mongodb package from npm:

$ npm install fortune-mongodb

Then use it with Fortune:

const fortune = require('fortune')
const mongodbAdapter = require('fortune-mongodb')

const store = fortune({ ... }, {
  adapter: [
    mongodbAdapter,
    {
      // options object, URL is mandatory.
      url: 'mongodb://localhost:27017/test'
    }
  ]
})

Options

Adapter options:

For driver options, see the official documentation for details.

In addition to the constructor options, there is also the query function in the find method, which accepts the query object as an argument, and may either mutate or return the query object. This allows for arbitrary queries.

License

This software is licensed under the MIT License.