Monkey-patches node-mongodb-native to capture query performance metrics. Wraps the mongodb driver so every operation (find, insert, update, remove) reports duration in microseconds via a callback. Unwraps cleanly. Version 0.1.3 (latest) – no updates since 2014, stable for its narrow use case. Lightweight with no runtime dependencies beyond mongodb itself. Not compatible with mongodb@3+ due to internal API changes.
npm install mongodb-perf-wrapperNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates wrapping the mongodb module to log performance metrics for every operation and then cleanly unwrapping.
Use only once per process; consider isolating mongodb usage if multiple libraries patch it.
Pin mongodb driver to version ^2.x.
Consider migrating to a maintained alternative like 'mongodb-query-analyzer' or use APM tools.
Treat collection parameter as string name.
Use the require('mongodb') result, not a database connection.Use CommonJS require: const wrapper = require('mongodb-perf-wrapper');