Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Start the MongoDB shell (mongosh) mongosh // Show all databases show dbs // Switch to (or create) a database use myAppDB // Show all collections in the current database show collections // A sample BSON document (stored internally as binary JSON) { "_id": ObjectId("64a1f2b3c4d5e6f7a8b9c0d1"), "name": "Alice", "age": 30, "email": "alice@example.com", "address": { "city": "New York", "zip": "10001" }, "hobbies": ["reading", "cycling"], "createdAt": ISODate("2024-01-15T08:30:00Z") } // Check server status db.runCommand({ serverStatus: 1 }) // Drop a database (use with caution) db.dropDatabase()
Result
Open