MongoDB is a NoSQL database that stores data in flexible, JSON-like documents. Let's look at some of the core concepts you need to know to get started.
{ "_id": "101", "name": "John Doe", "email": "john@example.com", "age": 25, "skills": ["JavaScript", "MongoDB", "Node.js"] }
Each document can have different fields — MongoDB is schema-less.
show dbs
– List all databasesuse mydb
– Switch to or create a new database named "mydb"show collections
– List all collections in the current databasedb.users.insertOne({ name: "Alice", age: 28, email: "alice@example.com" });
db.users.find(); // Show all documents db.users.findOne(); // Show first document db.users.find({ age: 28 }); // Filter by field
db.users.updateOne( { name: "Alice" }, { $set: { age: 29 } } );
db.users.deleteOne({ name: "Alice" });
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!