Skip to content

Nosql MongoDB

Master Nosql MongoDB with 50 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.

🎓 50 cards ⏱️ ~25 min Advanced
Study Full Deck →
Share: 𝕏 Twitter LinkedIn WhatsApp

🎯 What You'll Learn

Preview Questions

12 shown

What is MongoDB?

Show ▼

MongoDB is a NoSQL document-oriented database that stores data in flexible, JSON-like documents called BSON. It is designed for scalability and high performance, making it ideal for applications with rapidly evolving schemas and large volumes of unstructured or semi-structured data.

What is the document model in MongoDB?

Show ▼

The document model stores data as documents, which are rich data structures similar to JSON objects. Each document can contain nested fields, arrays, and sub-documents, allowing related data to be stored together rather than spread across multiple tables as in relational databases.

What is BSON?

Show ▼

BSON (Binary JSON) is the binary-encoded serialization format MongoDB uses to store documents and make remote procedure calls. It extends JSON with additional data types such as Date, ObjectId, int, long, double, and binary, enabling efficient storage and traversal.

What is an ObjectId in MongoDB?

Show ▼

An ObjectId is a 12-byte unique identifier automatically generated by MongoDB as the default _id field for each document. It consists of: A 4-byte timestampA 5-byte random valueA 3-byte incrementing counter ObjectIds are sortable by creation time.

How do you insert a document in MongoDB?

Show ▼

Use db.collection.insertOne() for a single document or db.collection.insertMany() for multiple documents. Example: db.users.insertOne({ name: "Alice", age: 30 }). MongoDB automatically adds an _id field if not provided.

How do you query documents in MongoDB?

Show ▼

Use db.collection.find(filter, projection) to query documents. Example: db.users.find({ age: { $gt: 25 } }) returns all users older than 25. Use findOne() to return only the first matching document.

What are the basic CRUD operations in MongoDB?

Show ▼

MongoDB CRUD operations are: Create: insertOne(), insertMany()Read: find(), findOne()Update: updateOne(), updateMany(), replaceOne()Delete: deleteOne(), deleteMany()

What are MongoDB query operators?

Show ▼

MongoDB provides query operators for filtering: Comparison: $eq, $ne, $gt, $gte, $lt, $lte, $in, $ninLogical: $and, $or, $not, $norElement: $exists, $typeArray: $all, $elemMatch, $size

How do you update documents in MongoDB?

Show ▼

Use db.collection.updateOne(filter, update) or updateMany(). Update operators include $set (set fields), $unset (remove fields), $inc (increment), $push (add to array), and $pull (remove from array). Example: db.users.updateOne({ name: "Alice" }, { $set: { age: 31 } }).

What is the aggregation pipeline in MongoDB?

Show ▼

The aggregation pipeline processes documents through a sequence of stages, each transforming the data. Common stages include $match (filter), $group (aggregate), $project (reshape), $sort, $limit, and $lookup (join). It is MongoDB's primary tool for complex data analysis and transformation.

What does the $match stage do in the aggregation pipeline?

Show ▼

The $match stage filters documents based on specified conditions, similar to a find() query. It should be placed early in the pipeline to reduce the number of documents processed by subsequent stages. Example: { $match: { status: "active" } }.

What does the $group stage do in the aggregation pipeline?

Show ▼

The $group stage groups documents by a specified _id expression and applies accumulator operators like $sum, $avg, $min, $max, $push, and $first. Example: { $group: { _id: "$category", total: { $sum: "$price" } } }.

🎓 Start studying Nosql MongoDB

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Programming

📖 Learning Resources