Portable business logic for the MongoDB security model, providing utilities to humanize MongoDB privilege resources and check user privileges against actions. Version 1.6.0 is the current stable release; the package is part of the MongoDB Compass ecosystem but has not seen updates since 2016. It offers functions like humanize() to convert resource objects to literate strings and getResourcesWithActions() to filter resources by allowed actions, simplifying MongoDB authorization checks.
npm install mongodb-securityNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use humanize() to convert MongoDB privilege resources to readable strings, and getResourcesWithActions() to filter resources by allowed actions.
Consider using the MongoDB Node.js driver directly for privilege checks, or fork the package.
Accept English-only output or implement custom localization.
Install @types/mongodb-security from DefinitelyTyped or write a declaration file.
Run npm install mongodb-security
Use const security = require('mongodb-security'); instead of import.Ensure user object is retrieved with showPrivileges: true in the usersInfo command.
No dependency data recorded yet.