CodeMirror extension that adds autocompletion for MongoDB field names and query patterns, leveraging user-provided schema fields. Version 0.10.3, last updated in 2021, with low release cadence. Differentiators: integrates with CodeMirror's hint system to provide context-aware completions (e.g., field names, typed quotes/regex), and includes a MongoDB-themed editor theme. Supports CommonJS require and React via react-codemirror. No active development recently; relies on CodeMirror v5.
npm install codemirror-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a CodeMirror editor with MongoDB autocompletion based on a schema of fields, and enforces single-line input.
Use codemirror6 and find alternative MongoDB hint addon or implement custom.
Require 'codemirror-mongodb/addon/hint/mongodb-hint' instead of 'codemirror-mongodb'.
Do not assign the require to a variable; just require it alongside CodeMirror.
Include a 'mongodb' object with a 'fields' property in CodeMirror options.
Add '@import url(https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.0/theme/monokai.min.css);' or include the mongodb CSS file from the package.
Use require('codemirror-mongodb/addon/hint/mongodb-hint')Add 'mongodb: { fields: { ... } }' to the editor options.Ensure require('codemirror/addon/hint/show-hint') is called before mongodb-hint.