{"_id":"mongoose-execution-time","_rev":"5-2f896e2d36c74b54ad9b7809b343bc7e","name":"mongoose-execution-time","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"mongoose-execution-time","version":"1.0.0","description":"Mongoose plugin for measuring and logging query execution time","main":"dist/index.js","scripts":{"build":"tsc","prepare":"tsc"},"keywords":["mongoose","mongodb","database","query execution time"],"author":{"name":"Hamza Sabljakovic","email":"sabljakovich.hamza@gmail.com"},"license":"MIT","devDependencies":{"typescript":"^3.9.5"},"repository":{},"gitHead":"a6925a4d7c38cd471360473997636afbf908a139","_id":"mongoose-execution-time@1.0.0","_nodeVersion":"13.8.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-RKt2H2jcDxHPduffUh8g/Tak+IsylR3WEtWw0O+LeL5jmiHukjgnIBJtYspptBcpKkt1T9HO6uD65nVc4Ak6Gg==","shasum":"7c7b253bd0aa63f59eb518ab7591ec1c75e47f57","tarball":"https://registry.npmjs.org/mongoose-execution-time/-/mongoose-execution-time-1.0.0.tgz","fileCount":6,"unpackedSize":14830,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfS+AOCRA9TVsSAnZWagAASy8P/AoGGaQjwUVVmV8i7hqg\nBG+jouMV4FEAWNy4cKW4FkpW2qT0ZnuacKRhVvAaWBIBQgXs14UC5cu6lWU7\nJYXokjji/5+epp+gR4lLkkOjJfq7fcOFyI2AdDzyy6ZTy0Ce8JOdnafNzsQk\niz1L1HF+916qQCg3bCD1laWMexMrI1IQIjr1q3+nB2u+698PHlGI7ikE+luQ\ngOxSrPh0+u9OqzrskkL36uBK+rbTQ4OM3BH9jKnzOYZAg4R/nk4AFmn/R+Ex\nPXO3WHh6cybWB7jPEE4832Oty3ilR77ZMOxUxmaVHma6IxMcfS+IzSjRLKbc\noF/Xq1OcWJ0yQj6dk9VWygBzhJB1fPrYmFiymwtHSQdiFkA2PNNYBN143hfv\nXWDSetKxv/8QNvrdtuns8pveyNtmMStNHMhlIkWs2FcUF4p8oZCaWpZh7OVN\nougotHSjhforfCAMxNN1Nb0V7PHK70bzmn9h2Acc1ViGckvjRWZ26nt0YFLE\nlfx9Grn+8JL3S6XYpxNUy9OuDiaFRW0pRCyxM5xkrMHWLDYnqXs3T/KwuG+m\nPD3ha5sT1w0kUBDZByrP1fI9UZ6gXY9FteOWxnCylvGXDxd8Zvvz71H8ZDeW\nZkgiTr2I7mn2fMJoaZK4d4gxbjU7XOpCTzBdXHwnjHsKUpSUKeCePNjGod6Z\nuAZe\r\n=Em2t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH/8438FO/TZFMFwZZOvueu0qw4xIEVs8Wk++x/2JF0/AiEAhOqZCcVHv8dSdheni643q9UwiBSKrulQmrx6MTyTL6M="}]},"maintainers":[{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"}],"_npmUser":{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-execution-time_1.0.0_1598808077169_0.566912734329049"},"_hasShrinkwrap":false},"1.0.1":{"name":"mongoose-execution-time","version":"1.0.1","description":"Mongoose plugin for measuring and logging query execution time","main":"dist/index.js","scripts":{"build":"tsc","prepare":"tsc"},"keywords":["mongoose","mongodb","database","query execution time"],"author":{"name":"Hamza Sabljakovic","email":"sabljakovich.hamza@gmail.com"},"license":"MIT","devDependencies":{"typescript":"^3.9.5"},"repository":{"url":"git+https://github.com/sabljakovich/mongoose-execution-time.git"},"gitHead":"a6925a4d7c38cd471360473997636afbf908a139","bugs":{"url":"https://github.com/sabljakovich/mongoose-execution-time/issues"},"homepage":"https://github.com/sabljakovich/mongoose-execution-time#readme","_id":"mongoose-execution-time@1.0.1","_nodeVersion":"13.8.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-TO/mE987wF4fmfA4nHfhsF0UXPG2GnfMPqwkHSrsEe0LPDp24Rbwbp7vtMZWB19fy/4YRvvSftMZiu0PM4xxhA==","shasum":"b033ba2c00649d692d24bea5ebf05481a8e353da","tarball":"https://registry.npmjs.org/mongoose-execution-time/-/mongoose-execution-time-1.0.1.tgz","fileCount":6,"unpackedSize":14892,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfS+C9CRA9TVsSAnZWagAAOncP/iOJFlDENy1tFH9ez9En\n+mFxF7u5FjYJjCq2mxEUpSAljyjSZDFssRLof1KWLbVg4n1dCWFoVvG0s14C\nlWpklz5HVtEUOf7CBAW3r2fq32dsi3zg3Fg6T2f0fAGikLhSpNjlElERmd2S\nq5L3Axc5wX8USCa+e4mbG8nOI6dg0+Wa9TE49Ti33ICb8yYVXFIN7vCwJK6v\nbkkiXIZSR340R53J9kGdutoMIVKJ7GkemMFB7OCtonq3MQTULKAuL5x5rmJ6\n3PLirNiAIyKhpUEeJml5C0tmaXps0OWawFeWVsBu/MW2/ZS+SNiEtfc9tJm3\nucVpoNcHeuiphZShmue7DE3wnvciYenZ/c1a+GJDnD8XZtSHdQhDCaW5F67P\nogU+6dyLxglUrnPYOs668DJVxWtK93MqBoryf1wI1w/a9KvMv1+qBPskBOwz\nL8+FrQsJEVhL/2zBNw1kt/4m4JTQpmOk+6TkwVG5dxHsjbEP75xFhLAATLtZ\n31xPuv/4slrf+1SWSWy/cOS8+uYg3ynNJZvGiddKmwvVWQGLFiQRO+tEN5QE\nhtn+02gku+LRN1QApEI6A8EDxvYEjVPx+Zx+LBQZdgYtKaqewJpjdCWqnRpt\nDc0ZKCtc47+UvFgjD3CqxJhWbI4x/E8FateEwP7DJOuAid2Vyf79ff8Bll7T\nkyKz\r\n=MrT0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBcXS125McoeEnDTWN/wBeMdhN7LozBrgyNRghyiaA1aAiEAqf1Cavup+xc5fvHpIhcwkS2hDl4vCPHZD28VMN2MPLA="}]},"maintainers":[{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"}],"_npmUser":{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-execution-time_1.0.1_1598808253356_0.501364930477632"},"_hasShrinkwrap":false},"1.0.2":{"name":"mongoose-execution-time","version":"1.0.2","description":"Mongoose plugin for measuring and logging query execution time","main":"dist/index.js","scripts":{"build":"tsc","prepare":"tsc"},"keywords":["mongoose","mongodb","database","query execution time"],"author":{"name":"Hamza Sabljakovic","email":"sabljakovich.hamza@gmail.com"},"license":"MIT","devDependencies":{"typescript":"^3.9.5"},"repository":{"url":"git+https://github.com/sabljakovich/mongoose-execution-time.git"},"gitHead":"865b6eabee018a29b4f9b578ea66c5f55ff6c2b8","bugs":{"url":"https://github.com/sabljakovich/mongoose-execution-time/issues"},"homepage":"https://github.com/sabljakovich/mongoose-execution-time#readme","_id":"mongoose-execution-time@1.0.2","_nodeVersion":"13.8.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-ROCOxLNOQcXuNcEmpcYUj6oeLWuBWMZXOPW4duuCJwmm4b7hGuLEExwWiy/4TtMULkw/heCHHOvXjyPw2+g9iA==","shasum":"d6943b861eb84d9a780c2810c72c2853ee73d481","tarball":"https://registry.npmjs.org/mongoose-execution-time/-/mongoose-execution-time-1.0.2.tgz","fileCount":6,"unpackedSize":16359,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfTSuQCRA9TVsSAnZWagAAvTcP/2uRLTLKmij9a51waVYE\nkdIjdantbleiw4NjLN0bAoa+YIC3gtTJMwi0H9551iEdWOjlEGVHVG9HqDlG\nmRhy9fJnNK0Sol2oVnSOm92uj1Evv0CRUtfTTiMepgzr8tSjPfgwZiCZEWTS\neCvOploTBFnTmj1VmeGG/fCHHYvnwTstwPaUs88jArndD7WDCYpjb9v7jFFM\n5hJ6fRgduV9+CRFLdXmToGHZ5Dr5ldmMvPRyo1VduthTsRVtNwaghkJm9PxR\nl/v1x1urHAaqHAcBLypmS3vCY2HXzg42SViZWUisxKbxDC+2Dk73804DgUgb\nloH1ThqyxbOSY0cMZCtPBHLPYEGWqOqNRuAPAGujENrqZk9UwwOX2r6r+ypv\n9V36Vw7va+lMfqXeXOTeHFIq/ZzhoJ6siZCV7WS5sK8L735MOwXK4Z6GO0nu\nmlKdPVGMovnPt0D/9ttv4TKZiZrBrydAU75VRbaLDq18gOihttwZmCnVg+sd\nLhbwfbxmAKAd9xt4TA83YynkjmcT+d3QPLvY9eRsU+EXyiTtWFzweWLdILdl\n04FgsrGrYdsHwUwGouP/Hend/qcyoumA7zVk6eZjY3TfhUodN2JFyDyN07QP\nTBBYlEGU+BWLn6qUqtlrmff9wFO9umhagDhnGQGqy8RTStSp2+aMgazawyBO\nB1v9\r\n=zJ+W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCB5fCOyUqr2ruQ4aledJfkCcD/jWLPdhWXpp+Pw/IS8AIgQ+T4/OGvP5LGBsbg5271fxDYG47yJ0qC/VLU7HLt19A="}]},"maintainers":[{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"}],"_npmUser":{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-execution-time_1.0.2_1598892943814_0.9433007305565342"},"_hasShrinkwrap":false},"1.1.0":{"name":"mongoose-execution-time","version":"1.1.0","description":"Mongoose plugin for measuring and logging query execution time","main":"dist/index.js","scripts":{"build":"tsc","prepare":"tsc"},"keywords":["mongoose","mongodb","database","query execution time","logging","query time"],"author":{"name":"Hamza Sabljakovic","email":"sabljakovich.hamza@gmail.com"},"license":"MIT","devDependencies":{"typescript":"^5.1.6"},"repository":{"url":"git+https://github.com/sabljakovich/mongoose-execution-time.git"},"gitHead":"3156bc684da7ef673ddddb32889662ab31b0fedc","bugs":{"url":"https://github.com/sabljakovich/mongoose-execution-time/issues"},"homepage":"https://github.com/sabljakovich/mongoose-execution-time#readme","_id":"mongoose-execution-time@1.1.0","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"integrity":"sha512-hRYiapuuaIWoq2tA9FfKSbrUuWXEMTBixeFbdSqgIbZb227PLfmOIlyt27Tlbz5CD+F3DJBvHrnElYtKI2z2CQ==","shasum":"0cb89d82a9bfef567203d81346df6be941a02c00","tarball":"https://registry.npmjs.org/mongoose-execution-time/-/mongoose-execution-time-1.1.0.tgz","fileCount":6,"unpackedSize":17662,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbg6QZNU8ysMzvW9CaQIJ4JkYb7v334CnT4i1qKGLJwwIhANlE0q+5RlzQ7egmB/wQBB/NkQ68c9MXu04MjJ3dmtp0"}]},"_npmUser":{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"},"directories":{},"maintainers":[{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-execution-time_1.1.0_1689335703492_0.4632171298489216"},"_hasShrinkwrap":false},"1.1.1":{"name":"mongoose-execution-time","version":"1.1.1","description":"Mongoose plugin for measuring and logging query execution time","main":"dist/index.js","scripts":{"build":"tsc","prepare":"tsc"},"keywords":["mongoose","mongodb","database","query execution time","logging","query time"],"author":{"name":"Hamza Sabljakovic","email":"sabljakovich.hamza@gmail.com"},"license":"MIT","devDependencies":{"typescript":"^5.1.6"},"repository":{"url":"git+https://github.com/sabljakovich/mongoose-execution-time.git"},"gitHead":"b83417a6b3d885ef23b3584208518253e6aa123e","bugs":{"url":"https://github.com/sabljakovich/mongoose-execution-time/issues"},"homepage":"https://github.com/sabljakovich/mongoose-execution-time#readme","_id":"mongoose-execution-time@1.1.1","_nodeVersion":"16.6.2","_npmVersion":"7.20.3","dist":{"integrity":"sha512-1/kp7Gp/HlV2whQvulKTjpKFFYVv1yHfZGJIZiWu05pyWjuKaE3oMaEz59ZgchS5iRDXh6aTzCIKzmlpp+aQ4A==","shasum":"9e422e7960d32a147376b2bf81f857ee62362945","tarball":"https://registry.npmjs.org/mongoose-execution-time/-/mongoose-execution-time-1.1.1.tgz","fileCount":6,"unpackedSize":17997,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEAcPv0x7DYHVAPpOsbOXGdZWLNrY1nYB2Erpmw4mdzGAiB57WKoyESJ6d+oBDq11WLJV8+WFa/FjQrZJ2qNz+LDpg=="}]},"_npmUser":{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"},"directories":{},"maintainers":[{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-execution-time_1.1.1_1691775257568_0.8046426181562132"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-30T17:21:17.169Z","1.0.0":"2020-08-30T17:21:17.771Z","modified":"2023-08-11T17:34:17.935Z","1.0.1":"2020-08-30T17:24:13.488Z","1.0.2":"2020-08-31T16:55:43.959Z","1.1.0":"2023-07-14T11:55:03.683Z","1.1.1":"2023-08-11T17:34:17.755Z"},"maintainers":[{"name":"sabljakovich","email":"sabljakovich.hamza@gmail.com"}],"description":"Mongoose plugin for measuring and logging query execution time","keywords":["mongoose","mongodb","database","query execution time","logging","query time"],"repository":{"url":"git+https://github.com/sabljakovich/mongoose-execution-time.git"},"author":{"name":"Hamza Sabljakovic","email":"sabljakovich.hamza@gmail.com"},"license":"MIT","readme":"\n# Mongoose execution time\n\nMongoose plugin for measuring and logging query execution time.\n\n```bash\nnpm i mongoose-execution-time\n```\n\nOutput example:\n\n```sh\nQuery: find in customers completed in: 7 ms { filter: {} }\n\nQuery: find in blogposts completed in: 4 ms { filter: { title: 'Post 1' },\n  additionalLogProperties: { bruh: 1 } }\n\nQuery: findOne in blogposts completed in: 4 ms { filter: {} }\n\nQuery: estimatedDocumentCount in blogposts completed in: 3 ms { filter: {} }\n\nQuery: aggregate in blogposts completed in: 1 ms { aggregatePipeline: '[{\"$match\":{\"title\":\"Post 1\"}}]' }\n\nQuery: aggregate in blogposts completed in: 1 ms {\n  aggregatePipeline: '[{\"$match\":{\"title\":\"Post 1\"}},{\"$project\":{\"title\":1}}]'\n}\n\n\n```\n\n## How to use\n\n```js\nconst mongoose = require('mongoose');\nconst { logExecutionTime } = require('mongoose-execution-time');\n\nmongoose.plugin(logExecutionTime);\n```\n\n\n## Configuration\n\n\nThe plugin can be easily adjusted via the following configuration options.\n\n```ts\ninterface LogExecutionTimeConfig {\n    logger?: any;\n    loggerLevel?: string;\n    loggerVerbosity?: LoggerVerbosity;\n    loggerFunction?: LoggerFunction;\n}\n```\n\n\n| Option  | Description  | Default  |\n|---|---|---|\n| logger  | logger provider  | console   |\n| loggerLevel  | logger level used by the logger above  | debug  |\n| loggerVerbosity  | controls how much information gets logged  | High  |\n| loggerFunction | for full control over how the log gets written | N/A |\n\n\nCode example:\n\n```js\nconst mongoose = require('mongoose');\nconst { logExecutionTime } = require('mongoose-execution-time');\n\nmongoose.plugin(logExecutionTime, {\n    loggerLevel: 'info'\n});\n```\n## Do not want filter/aggregatePipeline information logged?\n\nSimply set the `loggerVerbosity` to `LoggerVerbosity.Normal` in the plugin configuration.\n\n```js\nconst mongoose = require('mongoose');\nconst { logExecutionTime, LoggerVerbosity } = require('mongoose-execution-time');\n\nmongoose.plugin(logExecutionTime, {\n    loggerVerbosity: LoggerVerbosity.Normal,\n    loggerLevel: 'info'\n});\n```\n\n## Logging additional information\n\nThe plugin exposes a method for logging additional information in the same log line as the execution time.\n\nCode example:\n\n```ts\nawait BlogPostModel.find({ title: 'Title' }).additionalLogProperties({ message: 'My custom message'});\n```\n\nOutput example:\n\n```\nQuery: find in blogposts completed in: 8 ms { additionalLogProperties: { message: 'My custom message' } }\n```\n\n## Log message configuration\n\nIf the default logger formatting or style doesn't fit your needs, it can be adjusted by providing a custom logger function.\n\nCode example:\n\n```ts\nconst mongoose = require('mongoose');\nconst { logExecutionTime } = require('mongoose-execution-time');\n\nmongoose.plugin(logExecutionTime, {\n    loggerFunction: (operation, collectionName, executionTimeMS, filter, update, additionalLogProperties, aggregationPipeline) => {\n        console.log(`My custom logger function | ${operation} | ${collectionName} | ${executionTimeMS}`, { filter, update, additionalLogProperties, aggregationPipeline })\n    }\n});\n```\n\nOutput example:\n\n```\nMy custom logger function | find | blogposts | 4 {\n  filter: { title: 'Post 1' },\n  update: undefined,\n  additionalLogProperties: { bruh: 1 }\n  aggregationPipeline: null\n}\n```","readmeFilename":"README.md","homepage":"https://github.com/sabljakovich/mongoose-execution-time#readme","bugs":{"url":"https://github.com/sabljakovich/mongoose-execution-time/issues"}}