MongoDB adapter for Fortune.

Fortune MongoDB Adapter

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

Install the fortune-mongodb package from npm:

$ npm install fortune-mongodb

Then use it with Fortune:

import Fortune from 'fortune'
import MongodbAdapter from 'fortune-mongodb'
const fortune = new Fortune({
  adapter: {
    type: MongodbAdapter,
    options: {
      url: 'mongodb://localhost:27017/test'

Adapter options:

  • url: MongoDB connection URL. Required.
  • generateId: Generate the _id key on a new document. It must be a function that accepts one argument, the record type, and returns a unique string or number. Optional.
  • typeMap: An object that maps type names (keys) to MongoDB collection names (values). For example, { user: 'users' }.

Driver options (see the official documentation for details):

  • db: options that affect the DB instance.
  • replSet: options that modify the ReplicaSet topology connection behavior.
  • mongos: options that modify the Mongos topology connection behavior.
  • server: options that modify the Server topology connection behavior.

This software is licensed under the MIT License.