Skip to content
Guide · Run SQL in your browser

MongoDB Online Playground: Practise Queries in Your Browser

Practise MongoDB queries online: write a find filter or an aggregation pipeline and run it against three sample collections in your browser. The playground uses Mingo, an open-source JavaScript implementation of the MongoDB query language, so it is for practice; the free ways to run a real MongoDB server are listed below.

This playground runs MongoDB query and aggregation syntax in your browser with Mingo, an open-source JavaScript implementation of the MongoDB query language. It is not a MongoDB server: use it to practise filters and pipelines, then run them for real in mongosh or Atlas.

Examples:
Sample data: tables and columns

Loads with the engine.

Facts on this page checked 8 October 2026 against the official documentation. Versions covered: Mingo 7.2.4; MongoDB Atlas Free clusters run MongoDB 8.0. Next review due April 2027. The playground runs entirely in your browser; nothing you type or open is sent to CodeWithSQL.
Short answer
  • The panel runs MongoDB query syntax with Mingo 7.2.4 in your browser. It is not a MongoDB server and does not connect to one.
  • Pick a collection (products, customers or orders) and an operation: find takes a filter document, aggregate takes a pipeline array.
  • You can type strict JSON or mongosh-style input with unquoted keys and single quotes. Up to 1,000 documents are shown as JSON.
  • For a real server at no cost, MongoDB Atlas offers a Free cluster (formerly called M0), and MongoDB Community Server runs locally or in Docker.
How we know: Written from the playground's own code and official pages (the Mingo repository, MongoDB documentation and the MongoDB Atlas pricing page), checked on 8 October 2026. The examples were written for the sample collections on this page.

How to use the MongoDB online playground

  1. Choose a Collection: products (9 documents: name, category, price, tags, stock), customers (5: name, country, address.city, vip) or orders (6: customer_id, date, status, items, total).
  2. Choose find (filter) and type only the filter document, for example { price: { $gt: 20 } }, not the full db.products.find(...) call. Or choose aggregate (pipeline) and type an array of stages.
  3. Press Run or Ctrl+Enter (Cmd+Enter on a Mac). The matching documents appear as JSON, with a count and timing.

Copy share link puts your query in the URL after #q= (nothing is stored on a server; the link fills the editor but does not run it). Reset data restores the sample collections. In a pipeline, $lookup can join the other two collections. Sample data: tables and columns under the editor lists every field in each collection.

Example queries for MongoDB online practice

Set the collection and operation shown in each label before running. The syntax is the same as in mongosh.

products, find: hardware under 60
{ category: 'Hardware', price: { $lt: 60 } }
customers, find: dot notation into an embedded document
{ 'address.city': 'Leeds' }
orders, aggregate: revenue and order count by status
[
  { $group: { _id: '$status', orders: { $sum: 1 }, revenue: { $sum: '$total' } } },
  { $sort: { revenue: -1 } }
]
orders, aggregate: join each delivered order to its customer ($lookup)
[
  { $match: { status: 'delivered' } },
  { $lookup: { from: 'customers', localField: 'customer_id', foreignField: '_id', as: 'customer' } },
  { $project: { total: 1, 'customer.name': 1 } }
]

What the playground is not

Mingo describes itself as the MongoDB query language for in-memory objects. It implements MongoDB's operators in JavaScript, separately from MongoDB itself, so treat results as practice and confirm important queries on a real server. In particular:

  • There are no shell commands (db.collection.insertOne, show dbs), indexes, explain output or users.
  • find takes a filter only; to shape the output, use a $project stage in an aggregation.
  • The three collections are fixed and reset when you reload the page.

Free ways to run real MongoDB

MongoDB Atlas Free cluster. MongoDB's pricing page describes a free-forever tier, which the Atlas documentation now calls a Free cluster (formerly M0). It includes 512 MB of storage, 32 MB of sort memory and up to 100 operations per second. You can deploy one Free cluster per project, and Atlas uses MongoDB 8.0 for Free clusters. Atlas also lets you run aggregation pipelines in its web interface. See our MongoDB Atlas pricing page and MongoDB hosting options.

MongoDB Community Server. The free Community Edition installs on Windows, macOS and Linux from mongodb.com. MongoDB's documentation also covers running it in Docker with its mongodb/mongodb-community-server image, and there is a Docker Official Image called mongo. Connect with mongosh, which MongoDB describes as a JavaScript and Node.js REPL for working with MongoDB deployments.

Coming from SQL? Read SQL vs NoSQL and MongoDB vs PostgreSQL.

Privacy

Mingo and the sample collections are loaded from this site and run in your browser. What you type is parsed as data (it is never executed as code) and is not sent to CodeWithSQL or to MongoDB. A share link contains your query text, so anyone with the link can read it.

To practise the SQL side, try the SQL exercises or the SQL beginner course.

Frequently asked questions

Is this a real MongoDB database?

No. It is Mingo, a JavaScript library that evaluates MongoDB filters and aggregation pipelines over documents held in your browser. Use it to learn the syntax, then run queries on Atlas or a local server.

Can I host MongoDB online for free?

Yes, with an Atlas Free cluster: 512 MB of storage and up to 100 operations per second, one per project. MongoDB positions it for learning and exploring rather than production.

Can I paste a query from mongosh?

Paste the filter or the pipeline array, not the db.collection.find(...) wrapper. Unquoted keys and single-quoted strings are accepted.

Is there a MongoDB Compass online?

MongoDB Compass is a GUI that you download and run on macOS, Windows or Linux, not a website. The nearest browser-based options are the Atlas web interface for your own Atlas clusters and this playground for practice.

Can I join collections?

Yes. In an aggregation, a $lookup stage can read from any of the three sample collections, as in the example above.

Sources

Checked 8 October 2026.

How we research tool pages: our editorial method. The engines are open-source projects credited on each page.

Want structured practice?

Work through real problems with hints and solutions, or follow the beginner course.