Skip to content
Monghoul

Query editor and environment

A Monaco editor over the MongoDB Node driver, with a JavaScript sandbox around it.

Checked against v1.11.0 Updated
The autocomplete list open on a nested field path, each entry showing its type
Query editor · Typing "shipping." offers only the child fields, with types

The editor

  • Full Monaco (VS Code) editor with JavaScript syntax highlighting, configurable font size, and theme-aware styling
  • Inline syntax and type errors, checked against the query environment’s own declarations
  • The environment is the MongoDB Node driver, not the mongo shell. A projection passed as find’s second argument is refused rather than quietly ignored
  • db.orders is shorthand for db.collection(‘orders’), and it yields to real driver methods, so stats, admin, and command need the explicit form
  • The editor understands the shorthand too: typing db. suggests the collections, and db.orders carries the same analyzed document type the explicit form does

The query environment

  • A single expression returns its value automatically. A multi-statement script runs in order and returns an explicit result
  • A query is not reported finished until the database operations it started have finished
  • Sandbox globals: db, ObjectId, the id() shorthand, ISODate, NumberLong/Int/Decimal, Extended JSON helpers, print, sleep, URL, encoding, crypto, and fetch
  • Bundled libraries: Faker, Luxon, Day.js, Lodash, Lodash FP, and Zod
  • BSON numeric constructors keep their type and precision. A value the type cannot hold is rejected, not truncated
  • Console and print output appears with the result, warnings emphasized, capped at 500 entries per run

Output and formatting

  • Code formatting with Prettier via Ctrl/Cmd+S, a floating button, or Shift+Alt+F inside the editor
  • Method chains break onto separate lines without changing behavior, and generated code is formatted on tab creation
  • Run with Ctrl+Enter / Cmd+Enter / Cmd+R, plus Explain and Stop buttons and an elapsed timer

Running a query

  • Cancellation stays available while the connection is still being established
  • Result timing separates query, connection, server, and total duration
  • Changing a tab’s connection keeps the selected database only when the new connection has one by that name
  • Save to, sync with, or remove from favorites straight from the toolbar. Queries and notes autosave