MongoDB adapter for the Fortune.js ORM-like library. Current stable version is 1.3.2. Release cadence is low, with the last release in 2019. It uses the official MongoDB Node.js driver internally and supports transactions, custom ID generation, and type-to-collection mapping. Differentiators: integrates directly with Fortune's API, supports transactions, and allows arbitrary queries via the find method's query function. Requires Node.js >=8 and Fortune.js as a peer dependency.
npm install fortune-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates setting up Fortune with the MongoDB adapter, defining a simple schema with two record types (user and post), and performing a find operation.
Ensure fortune version matches the adapter's requirements; see package.json peerDependencies.
Use adapter: [adapterFunction, optionsObject] instead of adapter: { adapter: ..., url: ... }.Consider using a more modern adapter or updating the driver manually.
Ensure your MongoDB instance is configured as a replica set before enabling transactions.
Provide a function that returns globally unique IDs, e.g., using uuid.
Run npm install fortune fortune-mongodb to install both packages.
Correct usage: adapter: [require('fortune-mongodb'), { url: '...' }]Either set enableTransactions: false or configure MongoDB as a replica set.
Start MongoDB (e.g., mongod) or check the url option.