{"id":19932750,"url":"https://github.com/mixmaxhq/mongo-slow-queries","last_synced_at":"2025-05-03T11:32:52.868Z","repository":{"id":49156705,"uuid":"81126991","full_name":"mixmaxhq/mongo-slow-queries","owner":"mixmaxhq","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-20T17:16:07.000Z","size":183,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-10-15T15:42:55.471Z","etag":null,"topics":["corgi-tag","mongodb","monitoring","query-monitoring"],"latest_commit_sha":null,"homepage":"https://www.mixmax.com/careers","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mixmaxhq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-02-06T20:03:02.000Z","updated_at":"2023-07-12T22:40:19.000Z","dependencies_parsed_at":"2023-11-20T18:41:51.048Z","dependency_job_id":null,"html_url":"https://github.com/mixmaxhq/mongo-slow-queries","commit_stats":{"total_commits":37,"total_committers":10,"mean_commits":3.7,"dds":0.7837837837837838,"last_synced_commit":"4131d37b438c0c80db2b1a1b3ebacd95dfec1c0b"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixmaxhq%2Fmongo-slow-queries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixmaxhq%2Fmongo-slow-queries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixmaxhq%2Fmongo-slow-queries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mixmaxhq%2Fmongo-slow-queries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mixmaxhq","download_url":"https://codeload.github.com/mixmaxhq/mongo-slow-queries/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224360219,"owners_count":17298319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["corgi-tag","mongodb","monitoring","query-monitoring"],"created_at":"2024-11-12T23:11:26.661Z","updated_at":"2024-11-12T23:11:27.352Z","avatar_url":"https://github.com/mixmaxhq.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongo-slow-queries\nA module for pulling slow queries from Mongo, tagged with metadata as well.\n\n## Install\n```\n$ npm install mongo-slow-queries\n```\n\n## Usage\n\n### Initialization\n\nTo use `mongo-slow-queries` you just need to provide a Mongo DB reference when\ncreating an instance:\n\n```js\nconst mongojs = require('mongojs');\nconst MongoSlowQueryChecker = require('mongo-slow-queries');\n\nlet db = mongojs('mongodb://localhost:27017/admin');\nlet slowQueries = new MongoSlowQueryChecker({ db });\n```\n\nIf the `db` object has an `adminCommand` method, it need not be a reference to \nthe `admin` database.\n\n### Querying for slow queries\nQuerying for slow queries is then as simple as calling `get`:\n\n```js\nslowQueries.get((err, queries) =\u003e {\n  if (err) {\n    console.log('Failed to retrieve slow queries: ' + queries);\n  } else {\n    console.log('slow queries: ' + JSON.stringify(queries));\n  }\n});\n```\n\n### Query duration threshold\nBy default, `mongo-slow-queries` only returns queries that are currently\nrunning that have already taken greater than five seconds to run. If you wish\nto use a different threshold value, simply pass it in when you construct the\nMongo slow query checker:\n\n```js\nlet slowQueries = new MongoSlowQueryChecker({\n  db,\n  queryThreshold: 2 // The unit of time is in seconds.\n});\n```\n\n\n### Changelog\n* 1.0.1 Fix which `query` we fingerprint.\n* 1.0.0 Initial release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmixmaxhq%2Fmongo-slow-queries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmixmaxhq%2Fmongo-slow-queries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmixmaxhq%2Fmongo-slow-queries/lists"}