{"id":19839,"library":"eslint-plugin-mongo","title":"eslint-plugin-mongo","description":"ESLint plugin providing environments for MongoDB server-side scripts (mapReduce, eval, $where) and MongoDB shell scripts. Version 1.0.5 is the latest and only release. It defines global variables specific to MongoDB contexts to prevent false positives in ESLint. Limited to environment definitions; does not include custom rules. Requires ESLint as a peer dependency. Last updated in 2018; no active development.","status":"maintenance","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/ispringer/eslint-plugin-mongo","tags":["javascript","eslint","eslintplugin","eslint-plugin","mongo","mongodb"],"install":[{"cmd":"npm install eslint-plugin-mongo","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-mongo","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-mongo","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin only works within ESLint","package":"eslint","optional":false}],"imports":[{"note":"Plugin name prefix 'eslint-plugin-' should be omitted in ESLint config.","wrong":"{ \"plugins\": [\"eslint-plugin-mongo\"] }","symbol":"eslint-plugin-mongo","correct":"// In .eslintrc: { \"plugins\": [\"mongo\"] }"},{"note":"Environment name uses slash, not hyphen.","wrong":"{ \"env\": { \"mongo-server-side\": true } }","symbol":"mongo/server-side","correct":"// In .eslintrc: { \"env\": { \"mongo/server-side\": true } }"},{"note":"Environment name uses slash, not hyphen.","wrong":"{ \"env\": { \"mongo-shell\": true } }","symbol":"mongo/shell","correct":"// In .eslintrc: { \"env\": { \"mongo/shell\": true } }"}],"quickstart":{"code":"// Install: npm install eslint eslint-plugin-mongo --save-dev\n// .eslintrc.json\n{\n  \"plugins\": [\"mongo\"],\n  \"env\": {\n    \"mongo/shell\": true\n  }\n}","lang":"javascript","description":"Quick setup to enable MongoDB shell environment in ESLint: install packages and configure plugin and environment."},"warnings":[{"fix":"Consider using eslint-plugin-mongodb or writing custom globals.","message":"Package is unmaintained since 2018.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Combine with other plugins or define custom rules.","message":"Plugin only defines environments, no rules. May not meet all linting needs.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually add globals in ESLint config.","message":"Environments may not include all MongoDB globals (e.g., ObjectId, ISODate).","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.5':23 '2018':62 'activ':64 'context':37 'custom':51 'defin':31 'definit':47 'depend':58 'develop':65 'environ':8,46 'eslint':2,5,43,54,67,70 'eslint-plugin':69 'eslint-plugin-mongo':1 'eslintplugin':68 'eval':16 'fals':40 'global':32 'includ':50 'javascript':66 'last':59 'latest':26 'limit':44 'mapreduc':15 'mongo':4,72 'mongodb':10,19,36,73 'peer':57 'plugin':3,6,71 'posit':41 'prevent':39 'provid':7 'releas':29 'requir':53 'rule':52 'script':14,21 'server':12 'server-sid':11 'shell':20 'side':13 'specif':34 'updat':60 'variabl':33 'version':22","created_at":"2026-04-25T11:19:56.565070+00:00","updated_at":"2026-04-25T11:19:56.565070+00:00","problems":[{"fix":"Run 'npm install eslint-plugin-mongo --save-dev' and ensure node_modules is accessible.","cause":"Plugin not installed or ESLint cannot resolve it.","error":"Error: Failed to load plugin 'mongo' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-mongo'"},{"fix":"Enable the 'mongo/shell' environment in your ESLint config.","cause":"MongoDB shell globals like 'db' are not recognized by ESLint.","error":"Parsing error: The keyword 'db' is not defined."},{"fix":"Check plugin documentation; only environments are provided.","cause":"Plugin does not provide custom rules.","error":"Definition for rule 'mongo/rule-name' was not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/ispringer/eslint-plugin-mongo","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-mongo","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}