A Hapi.js plugin for managing multiple MongoDB connections, designed for Hapi >= 17. Current version 5.1.1. It decorates the server or request object with MongoDB client instances, supporting complex configurations with multiple servers, custom names, and connection options. Differs from hapi-mongodb by focusing on multiple connections and offering flexible configuration via strings, objects, or arrays.
npm install hapi-multi-mongoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Registers hapi-multi-mongo with a single MongoDB connection and decorates server.mongo. Defines a route that queries a collection.
Access database via server.mongo.dbName or request.mongo.dbName, then call .collection() on that db object.
Install hapi-multi-mongo@3.1.1 for older Hapi versions.
Set decorate: true in options to access via server.mongo.
Always include a database in the URI or provide an explicit name per connection.
Update to hapi-multi-mongo@5.x and ensure mongodb driver is installed (npm install mongodb).
Enable decorate:true or use request.mongo. Verify connection name matches database name.
Provide a name property for each connection object, e.g., { uri: '...', name: 'myConn' }.