Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fortune-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fortune-mongodb

MongoDB adapter for Fortune.

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:

  • url: MongoDB connection URL. Required.
  • enableTransactions: Use transactions for handling requests, this requires MongoDB to be using a replica set. Default: false.
  • 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' }.

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.

Keywords

FAQs

Package last updated on 23 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc