Get access to the Mongodb playground with one click
Welcome to the MongoDB Playground!
MongoDB 7.0 on Debian 12 — the leading document-oriented NoSQL database. mongod starts automatically; the codeground database is ready within 5 seconds.
Tip: Connect with
mongosh codeground. The codeground database and demo collection are pre-created for you.What’s Pre-installed
- mongod 7.0 (starts in background automatically)
- mongosh — the official MongoDB Shell
- Demo database:
codegroundwith ademocollection
Quick Start
mongosh codeground
db.demo.find()
db.demo.insertOne({ name: "Alice", role: "admin" })Common Workflows
# CRUD operations
db.users.insertMany([{ name: "Bob", age: 30 }, { name: "Carol", age: 25 }])
db.users.find({ age: { $gte: 28 } })
db.users.updateOne({ name: "Bob" }, { $set: { age: 31 } })
db.users.deleteOne({ name: "Carol" })
# Aggregation pipeline
db.users.aggregate([
{ $match: { age: { $gte: 25 } } },
{ $group: { _id: "$role", count: { $sum: 1 }, avgAge: { $avg: "$age" } } },
{ $sort: { count: -1 } }
])Advanced Tips
# Create an index
db.users.createIndex({ name: 1 }, { unique: true })
db.users.explain().find({ name: "Alice" })
# Atlas Search-style text search
db.users.createIndex({ name: "text" })
db.users.find({ $text: { $search: "alice" } })
# Export/import
mongodump --db codeground --out /tmp/backup
mongorestore --db codeground /tmp/backup/codegroundSession Notes
- Session lasts 1 hour.
mongodstarts in background — if not ready yet, wait a few seconds and retry.- No authentication required in this sandbox.