No-SQL Unit 2: Questions & Answers
Unit 2: Document Databases using MongoDB -> Generated and Prepared By Thiruselvan (ThiruXD)
PART A: MULTIPLE CHOICE QUESTIONS (1 Mark Each)
Set 1: Fundamentals of Document Databases
Q1. Which data format is MongoDB documents most closely related to?
- A. SQL table
- B. JSON-like document
- C. Spreadsheet cell
- D. Binary image
Explanation: MongoDB stores data as BSON documents, which are binary representations of JSON-like documents with field-and-value pairs.
Q2. What is the basic unit of data storage in MongoDB?
- A. Row
- B. Column
- C. Document
- D. Worksheet
Explanation: A document is the fundamental unit of data storage in MongoDB, similar to a row in relational databases.
Q3. Which command switches to a database in mongosh?
- A.
go collegeDB - B.
use collegeDB - C.
open collegeDB - D.
select collegeDB
Explanation: The use command is used to switch to a specific database. If the database doesn’t exist, it is created when data is inserted.
Q4. Which method inserts one document into a collection?
- A.
insertOne() - B.
addRow() - C.
createTable() - D.
pushDoc()
Explanation: insertOne() is the MongoDB method for inserting a single document into a collection.
Q5. Which method is used to read multiple documents?
- A.
scan() - B.
find() - C.
selectAll() - D.
readMany()
Explanation: find() is used to read multiple documents from a collection based on optional query criteria.
Q6. Which operator is commonly used to update a field value?
- A.
$set - B.
$read - C.
$table - D.
$row
Explanation: $set is the update operator used to set or change the value of a field in a document.
Q7. Which structure improves query performance?
- A. Index
- B. Footer
- C. Cursor
- D. Comment
Explanation: Indexes are special data structures that improve query performance by allowing faster document lookup.
Q8. Which stage is used for grouping in aggregation?
- A.
$sort - B.
$match - C.
$group - D.
$limit
Explanation: $group is the aggregation stage used to group documents and compute totals, averages, counts, and other aggregate values.
Set 2: MongoDB Architecture & Features
Q9. What does BSON stand for?
- A. Binary Structured Object Notation
- B. Binary JSON
- C. Basic Serialized Object Notation
- D. Byte System Object Notation
Explanation: BSON stands for Binary JSON, which is the binary representation format MongoDB uses to store documents.
Q10. Which of the following is NOT a core feature of document databases?
- A. Flexible schema
- B. Nested documents
- C. Fixed schema with columns
- D. Arrays
Explanation: Fixed schema with columns is a feature of relational databases, not document databases. Document databases have flexible schema.
Q11. In MongoDB, a collection is analogous to which concept in relational databases?
- A. Row
- B. Table
- C. Database
- D. Column
Explanation: A collection in MongoDB is similar to a table in relational databases, but without a fixed row schema.
Q12. Which connection string protocol is used for MongoDB Atlas clusters?
- A.
mongodb:// - B.
mongodb+srv:// - C.
mongo:// - D.
atlas://
Explanation: mongodb+srv:// is used for SRV connection strings, which are commonly used by MongoDB Atlas clusters.
Q13. What is the default port for MongoDB?
- A. 8080
- B. 27017
- C. 3306
- D. 5432
Explanation: MongoDB uses port 27017 as the default port for client connections.
Q14. Which shell command displays all available databases?
- A.
show databases - B.
show dbs - C.
list dbs - D.
display dbs
Explanation: show dbs is the mongosh command used to display all available databases.
Set 3: CRUD Operations
Q15. Which method updates multiple matching documents?
- A.
updateOne() - B.
updateMany() - C.
updateAll() - D.
modifyMany()
Explanation: updateMany() updates all documents that match the specified filter criteria.
Q16. Which query finds students with marks greater than 80 in MongoDB?
- A.
db.students.find({ marks: ">80" }) - B.
db.students.find({ marks: { $gte: 80 } }) - C.
db.students.find({ marks: { $gt: 80 } }) - D.
db.students.find({ marks > 80 })
Explanation: The $gt (greater than) comparison operator is used to find documents where the field value is greater than the specified value.
Q17. Which projection shows only name and department fields?
- A.
db.students.find({}, { name, department }) - B.
db.students.find({}, { name: 0, department: 0 }) - C.
db.students.find({}, { name: 1, department: 1, _id: 0 }) - D.
db.students.find({}, { name: true, department: true })
Explanation: In projection, 1 includes the field and 0 excludes it. _id is included by default, so it must be explicitly excluded.
Q18. Which operator adds an item to an array?
- A.
$add - B.
$push - C.
$append - D.
$insert
Explanation: $push is the update operator that adds an item to an array field.
Q19. Which method deletes all documents from a collection?
- A.
drop() - B.
clear() - C.
deleteMany({}) - D.
removeAll()
Explanation: deleteMany({}) with an empty filter deletes all documents from a collection.
Q20. Which method is used to count documents in a collection?
- A.
db.collection.size() - B.
db.collection.countDocuments() - C.
db.collection.total() - D.
db.collection.length()
Explanation: countDocuments() is the method used to count the number of documents in a collection.
Set 4: Data Modelling
Q21. Which design approach stores related data inside the same document?
- A. Embedding
- B. Referencing
- C. Normalization
- D. Denormalization
Explanation: Embedding is the design approach where related data is stored inside the same document.
Q22. When should referencing be used instead of embedding?
- A. When data is always read together
- B. When data has a bounded size
- C. When related data is large or frequently updated independently
- D. When data rarely changes
Explanation: Referencing is preferred when related data is large, shared across documents, or frequently updated independently.
Q23. What is the primary consideration for MongoDB data modelling?
- A. Normalization rules
- B. Application access patterns
- C. Storage space optimization
- D. Data type compatibility
Explanation: Good MongoDB data modelling starts with understanding how the application reads and writes data (access patterns).
Q24. Which of the following is a problem with embedding?
- A. Unlimited array growth
- B. Multiple queries required
- C. Data duplication
- D. Complex joins
Explanation: Unlimited array growth is a problem with embedding because very large arrays inside one document can become inefficient.
Set 5: Indexing
Q25. Which index type supports queries on multiple fields?
- A. Single-field index
- B. Compound index
- C. Multikey index
- D. Text index
Explanation: Compound indexes support queries using multiple fields in a defined order.
Q26. Which index type indexes values inside an array field?
- A. Single-field index
- B. Compound index
- C. Multikey index
- D. Text index
Explanation: Multikey indexes are used to index values inside an array field.
Q27. Which index prevents duplicate values for a field?
- A. Text index
- B. Compound index
- C. Multikey index
- D. Unique index
Explanation: Unique indexes prevent duplicate values for a field or combination of fields.
Q28. What is the downside of having too many indexes?
- A. Slower read operations
- B. Slower write operations and more storage
- C. Data corruption
- D. Reduced query capabilities
Explanation: Each index uses storage and must be updated on every write operation, slowing down insert, update, and delete operations.
Q29. Which method checks if a query is using an index?
- A.
db.collection.analyze() - B.
db.collection.find().explain("executionStats") - C.
db.collection.stats() - D.
db.collection.indexStats()
Explanation: explain("executionStats") provides detailed information about query execution, including whether an index was used.
Set 6: Aggregation Framework
Q30. Which aggregation stage filters documents based on conditions?
- A.
$group - B.
$match - C.
$project - D.
$sort
Explanation: $match is the aggregation stage that filters documents based on specified conditions.
Q31. Which aggregation stage reshapes documents by selecting or removing fields?
- A.
$group - B.
$match - C.
$project - D.
$sort
Explanation: $project is used to select, remove, or reshape fields in aggregation pipelines.
Q32. Which stage breaks array values into separate documents?
- A.
$split - B.
$array - C.
$unwind - D.
$flatten
Explanation: $unwind separates each element in an array into its own document for further processing.
Q33. Which aggregation stage performs a left outer join?
- A.
$join - B.
$connect - C.
$lookup - D.
$merge
Explanation: $lookup performs a left outer join-like operation with another collection.
Q34. Which stage limits the number of output documents?
- A.
$count - B.
$limit - C.
$top - D.
$first
Explanation: $limit restricts the number of documents passed to the next stage in an aggregation pipeline.
Q35. Which stage sorts documents in aggregation?
- A.
$order - B.
$sort - C.
$arrange - D.
$sequence
Explanation: $sort is the aggregation stage used to sort documents based on specified fields.
Set 7: BSON & Data Types
Q36. Which additional data type does BSON support that plain JSON does not?
- A. String
- B. Number
- C. ObjectId
- D. Boolean
Explanation: BSON supports additional data types like ObjectId and date values that are not available in plain JSON.
Q37. What is the default unique identifier field in MongoDB documents?
- A.
id - B.
_id - C.
uuid - D.
key
Explanation: MongoDB documents automatically include an _id field as the primary key, which is unique by default.
Q38. What type of value is ObjectId("...")?
- A. String
- B. BSON ObjectId
- C. Integer
- D. Binary data
Explanation: ObjectId is a BSON data type used as the default primary key for MongoDB documents.
Set 8: MongoDB Shell & Tools
Q39. Which tool provides a graphical interface for MongoDB?
- A. mongosh
- B. MongoDB Compass
- C. MongoDB Shell
- D. MongoDB Server
Explanation: MongoDB Compass is the graphical user interface for browsing databases, collections, and running queries.
Q40. What is the recommended source for latest installation instructions?
- A. Third-party blogs
- B. Official MongoDB documentation
- C. YouTube tutorials
- D. Stack Overflow
Explanation: Always refer to the official MongoDB documentation for current installation instructions as steps may change.
Set 9: Performance & Best Practices
Q41. Which of the following improves read performance?
- A. Creating appropriate indexes
- B. Adding more fields to documents
- C. Using larger documents
- D. Removing all indexes
Explanation: Appropriate indexes improve read performance by allowing faster document lookup without scanning all documents.
Q42. What should be placed early in an aggregation pipeline for better performance?
- A.
$project - B.
$match - C.
$group - D.
$sort
Explanation: Place selective $match stages early in the pipeline to reduce the number of documents processed in later stages.
Q43. What happens when a document grows beyond 16MB in MongoDB?
- A. MongoDB automatically compresses it
- B. MongoDB cannot store it (16MB limit)
- C. MongoDB splits it into multiple documents
- D. MongoDB stores it in multiple chunks
Explanation: MongoDB has a maximum document size limit of 16MB.
Set 10: Miscellaneous
Q44. Which command clears the shell screen in mongosh?
- A.
clear - B.
cls - C.
clean - D.
reset
Explanation: cls is the command to clear the shell screen in many terminals when using mongosh.
Q45. What does the $inc operator do?
- A. Increases string length
- B. Increments a numeric value
- C. Adds a new field
- D. Increases document size
Explanation: $inc is used to increment a numeric field by a specified value.
Q46. Which command exits the mongosh shell?
- A.
quit - B.
close - C.
exit - D.
stop
Explanation: exit is the command to exit the mongosh shell.
Q47. What is the purpose of db.dropDatabase()?
- A. Drop a collection
- B. Delete the current database
- C. Remove all documents
- D. Disconnect from database
Explanation: db.dropDatabase() deletes the current database and all its collections.
Q48. Which stage would you use to compute averages in aggregation?
- A.
$match - B.
$project - C.
$groupwith$avg - D.
$sort
Explanation: $group with the $avg accumulator operator is used to compute averages in aggregation.
Q49. Which query syntax is used for nested fields in MongoDB?
- A.
marks.dbms - B.
"marks.dbms" - C.
marks->dbms - D.
marks[dbms]
Explanation: Dot notation with quotes is used to access nested fields: "marks.dbms".
Q50. What is the primary advantage of MongoDB’s flexible schema?
- A. Documents can have different fields in the same collection
- B. All documents must have identical fields
- C. Schema cannot be changed
- D. Fields are limited to string values
Explanation: Flexible schema allows documents in the same collection to have different fields, accommodating varying data structures.
PART B: SHORT ANSWER QUESTIONS (5 Marks Each)
Q51. Define a document database. How is it different from a relational database?
Answer:
Document Database Definition: A document database is a NoSQL database model that stores records as flexible, self-describing documents containing field-and-value pairs. Each document can have different fields, and values can include strings, numbers, dates, arrays, and nested documents.
Differences from Relational Databases:
| Aspect | Document Database | Relational Database |
|---|---|---|
| Data Unit | Document in a collection | Row in a table |
| Schema | Flexible, dynamic schema | Fixed schema with columns and data types |
| Relationships | Managed via embedding or references | Managed using foreign keys and joins |
| Query Style | MongoDB Query Language | SQL queries |
| Scaling | Horizontal scaling (sharding) | Vertical scaling primarily |
| Best For | Hierarchical, changing data | Structured data with complex transactions |
Q52. Explain database, collection, and document in MongoDB with an example.
Answer:
Database: A logical container that holds collections. Multiple databases can exist on a single MongoDB server.
Collection: A group of MongoDB documents, similar to a table in relational databases but without a fixed row schema. Collections are schema-less.
Document: A single record consisting of field-and-value pairs, similar to a JSON object. Documents can contain nested documents and arrays.
Example:
// Database: collegeDB
use collegeDB
// Collection: students
db.students.insertOne({
// Document (record)
name: "Asha",
department: "CSE",
semester: 5,
marks: { // Nested document
dbms: 86,
python: 92
},
skills: ["Python", "MongoDB"] // Array
})Hierarchy: Database → Collection → Document → Fields
Q53. What is BSON? Why does MongoDB use BSON documents?
Answer:
BSON Definition: BSON (Binary JSON) is a binary-encoded serialization of JSON-like documents used internally by MongoDB to represent documents. It supports additional data types beyond standard JSON.
Why MongoDB uses BSON:
- Efficient Storage: Binary format is more compact than text-based JSON, reducing storage space and network bandwidth.
- Additional Data Types: BSON supports data types not available in JSON, including:
- ObjectId
- Date
- Binary data
- Regular expressions
- Decimal128
- Fast Parsing: Binary format can be parsed more quickly than text-based JSON.
- Rich Document Support: Enables nested documents and arrays.
- Traversability: BSON documents are designed to be traversed quickly.
Q54. List and explain any five core features of document databases.
Answer:
- Document-based Storage: Data is stored as documents containing fields and values. Example: A student document can store name, department, address, and marks together.
- Flexible Schema: Documents in the same collection need not have identical fields. One student may have internship details while another may not.
- Nested Documents: Documents can contain other documents as field values. Example:
address: {city: "Bengaluru", pin: 560001} - Arrays: Fields can store lists of values or lists of documents. Example:
skills: ["Python", "MongoDB", "Testing"] - Ad hoc Querying: Users can query based on fields, ranges, patterns, and conditions. Example: Find students with score greater than 80.
- Indexing: Indexes speed up frequently used queries. Example: Index on department improves department-based searches.
- Aggregation: Data can be filtered, grouped, sorted, and summarized inside the database. Example: Calculate average marks department-wise.
- Horizontal Scaling: Many document databases support distributed storage across multiple servers.
Q55. Write the steps to install and verify MongoDB in a beginner lab environment.
Answer:
Installation Steps:
- Visit the official MongoDB Community Server download page or installation documentation.
- Select the correct operating system (Windows, Ubuntu, macOS, or other supported platform).
- Download and install MongoDB Community Server using the installer or package manager instructions.
- Install MongoDB Shell (mongosh) if it’s not included or if a separate shell installation is required.
- Start the MongoDB server service. On many systems, the service name is
mongod. - Open a terminal or command prompt and run
mongoshto connect to the server.
Verification Steps:
// In mongosh shell
show dbs // Displays available databases
db.version() // Shows MongoDB version
db.stats() // Shows database statistics
use test // Switch to test database
db.test.insertOne({ name: "test" }) // Insert test document
db.test.find() // Read the inserted documentLaboratory Tip: Install MongoDB Community Server and mongosh before the lab session begins. Create one sample database folder or use the default service configuration for quick practice.
Q56. Explain the purpose of MongoDB connection strings with examples.
Answer:
Purpose of Connection Strings: Connection strings tell tools and applications where the MongoDB deployment is located and how to connect to it. They specify the host, port, authentication credentials, and other connection options.
Connection String Format:
mongodb://[username:password@]host[:port][/database][?options]Examples:
| Connection Method | Example | Purpose |
|---|---|---|
| Local mongosh | mongosh | Connects to default local MongoDB server |
| Explicit local URI | mongosh "mongodb://localhost:27017" | Connects to local server using a URI |
| Atlas SRV URI | mongosh "mongodb+srv://cluster-url" | Connects to MongoDB Atlas cluster |
| Application driver | MongoClient("mongodb://localhost:27017") | Allows programs to connect from Python, Node.js, Java, etc. |
| Compass GUI | Paste connection string in MongoDB Compass | Connects through a graphical interface |
Important Notes:
- Use
mongodb+srv://for SRV connection strings (Atlas clusters) - Use
mongodb://for standard connection strings (local servers) - Connection strings can include authentication:
mongodb://user:pass@localhost:27017/mydb
Q57. Write mongosh commands to create a database, insert one student document, and read it back.
Answer:
// 1. Connect to mongosh (in terminal)
mongosh
// 2. Create/Switch to database
use collegeDB
// 3. Insert one student document
db.students.insertOne({
name: "Sneha",
department: "AIML",
semester: 5,
marks: {
dbms: 85,
python: 90
},
skills: ["Python", "AI", "Machine Learning"]
})
// 4. Read the inserted document back
db.students.find({ name: "Sneha" })
// Optional: View in pretty format
db.students.find({ name: "Sneha" }).pretty()
// Optional: View all students
db.students.find()
// Verify database and collection
show dbs
show collectionsComplete Session Output:
test> use collegeDB
switched to db collegeDB
collegeDB> db.students.insertOne({ name: "Sneha", department: "AIML", semester: 5 })
{
acknowledged: true,
insertedId: ObjectId("...")
}
collegeDB> db.students.find({ name: "Sneha" })
{ _id: ObjectId("..."), name: "Sneha", department: "AIML", semester: 5 }Q58. Differentiate between insertOne() and insertMany().
Answer:
| Feature | insertOne() | insertMany() |
|---|---|---|
| Purpose | Inserts a single document | Inserts multiple documents at once |
| Syntax | db.collection.insertOne({...}) | db.collection.insertMany([{...}, {...}]) |
| Argument | Single document object | Array of document objects |
| Return Value | InsertOneResult with insertedId | InsertManyResult with insertedIds |
| Best Used For | Adding one new record | Adding a batch of records |
| Error Handling | Stops on first error | Stops on first error (ordered) |
Examples:
// insertOne() - Single document
db.students.insertOne({
name: "Kiran",
department: "ECE",
semester: 5
})
// insertMany() - Multiple documents
db.students.insertMany([
{ name: "John", department: "CSE", semester: 3 },
{ name: "Jane", department: "ISE", semester: 5 },
{ name: "Bob", department: "CSE", semester: 3 }
])Q59. Explain updateOne(), updateMany(), deleteOne(), and deleteMany() with examples.
Answer:
1. updateOne() Updates the first document that matches the filter condition.
// Update one document
db.students.updateOne(
{ name: "Ravi" },
{ $set: { city: "Mangaluru" } }
)2. updateMany() Updates all documents that match the filter condition.
// Update many documents
db.students.updateMany(
{ department: "CSE" },
{ $set: { mentor: "Dr. Rao" } }
)3. deleteOne() Deletes the first document that matches the filter condition.
// Delete one matching document
db.students.deleteOne({ name: "Kiran" })4. deleteMany() Deletes all documents that match the filter condition.
// Delete all students from a city
db.students.deleteMany({ city: "Hubballi" })Comparison Table:
| Method | Matches | Operation | Result |
|---|---|---|---|
updateOne() | First matching | Modifies fields | Updates 1 document |
updateMany() | All matching | Modifies fields | Updates all matching documents |
deleteOne() | First matching | Removes document | Deletes 1 document |
deleteMany() | All matching | Removes documents | Deletes all matching documents |
Caution: Delete operations remove documents permanently. Use carefully and consider backing up data.
Q60. What is projection in MongoDB queries? Give one example.
Answer:
Projection Definition: Projection is the feature in MongoDB queries that allows you to specify which fields to include or exclude in the returned documents. By default, all fields are returned.
Projection Syntax:
db.collection.find(query, projection)1ortrue: Include the field0orfalse: Exclude the field_idis included by default unless explicitly excluded
Examples:
// Show only name and department, exclude _id
db.students.find(
{},
{ name: 1, department: 1, _id: 0 }
)
// Show all fields except marks and skills
db.students.find(
{},
{ marks: 0, skills: 0 }
)
// Show only name and marks.dbms
db.students.find(
{},
{ name: 1, "marks.dbms": 1, _id: 0 }
)Benefits of Projection:
- Reduces network bandwidth usage
- Improves query performance
- Returns only necessary data to the application
- Enhances security by hiding sensitive fields
Q61. Explain embedding and referencing in MongoDB data modelling.
Answer:
Embedding: Related data is stored inside the same document as a nested document or array.
Use When:
- Related data is read together
- Data has a bounded size
- Data doesn’t change independently
Advantages:
- Fast single-document reads
- Natural document structure
- Atomic updates
Precautions:
- Avoid very large documents (16MB limit)
- Avoid unbounded arrays
Example:
{
name: "Asha",
department: "CSE",
address: {
city: "Mysuru",
pin: 570001
},
marks: {
dbms: 86,
python: 92
}
}Referencing: Related data is stored in separate collections and linked using IDs.
Use When:
- Related data is large
- Data is shared between documents
- Data is frequently updated independently
Advantages:
- Reduces duplication
- Separates large datasets
- More flexible for independent updates
Precautions:
- May require multiple queries
- May need aggregation lookup
Example:
// Student document (referencing department)
{
name: "Asha",
departmentId: ObjectId("...")
}
// Department document (separate collection)
{
_id: ObjectId("..."),
name: "CSE",
hod: "Dr. Rao"
}Q62. What is an index? Why should unnecessary indexes be avoided?
Answer:
Index Definition: An index is a special data structure that improves query performance by allowing MongoDB to locate documents faster without scanning every document in a collection. Similar to an index in a book.
Types of Indexes:
- Single-field index
- Compound index
- Multikey index
- Text index
- Unique index
- Geospatial index
Why Unnecessary Indexes Should Be Avoided:
- Storage Overhead: Each index consumes disk space. Multiple indexes can significantly increase storage requirements.
- Write Performance Impact: Every insert, update, and delete operation requires updating all indexes. More indexes mean slower write operations.
- Memory Usage: Indexes are loaded into memory for fast access. Unused indexes waste RAM.
- Maintenance Cost: Indexes need to be maintained, adding to administrative overhead.
- Performance Degradation: Too many indexes can actually degrade performance due to the query optimizer having to evaluate more options.
Best Practice:
- Create indexes based on actual query requirements
- Use
explain()to identify queries that need indexing - Remove unused indexes after analyzing workload
- Balance read performance against write performance
PART C: LONG ANSWER / ESSAY QUESTIONS (10 Marks Each)
Q63. Explain the document database paradigm in detail. Include document structure, flexible schema, nested documents, arrays, and common use cases.
Answer:
Document Database Paradigm Overview:
Document databases are a major category of NoSQL databases built around the concept of storing data as flexible, self-describing documents. Unlike relational databases that organize data into fixed rows and columns, document databases store data as field-and-value pairs in documents, similar to JSON objects.
1. Document Structure:
Documents are the fundamental unit of data storage. Each document contains:
- Field-and-value pairs (keys and values)
- Values can be of various types
Example Document:
{
"_id": ObjectId("..."),
"name": "Asha",
"department": "CSE",
"semester": 5,
"city": "Mysuru",
"marks": {
"dbms": 86,
"python": 92
},
"skills": ["Python", "MongoDB", "Testing"],
"contact": {
"email": "asha@college.edu",
"phone": "9876543210"
}
}2. Flexible Schema:
- Documents in the same collection need not have identical fields
- Fields can be added or removed without affecting other documents
- Allows for evolutionary data models
Example of Schema Flexibility:
// Student with internship
{
name: "Ravi",
department: "CSE",
internship: {
company: "Google",
duration: "6 months"
}
}
// Student without internship (same collection)
{
name: "Meena",
department: "CSE",
projects: ["AI Project", "DB Project"]
}3. Nested Documents:
- Documents can contain other documents as field values
- Enables hierarchical data representation
- Supports complex data structures
{
name: "Asha",
address: {
street: "MG Road",
city: "Mysuru",
pin: 570001,
state: "Karnataka"
},
marks: {
semester1: { dbms: 86, python: 92 },
semester2: { dbms: 88, python: 95 }
}
}4. Arrays:
- Fields can store lists of values or lists of documents
- Useful for storing multiple related items
- Supports array operations and indexing
{
name: "Asha",
skills: ["Python", "MongoDB", "Testing"],
courses: [
{ code: "CS101", name: "DBMS", grade: "A" },
{ code: "CS102", name: "Python", grade: "A+" }
],
previous_experience: [
{ company: "TechCorp", role: "Intern", duration: "3 months" },
{ company: "DataLabs", role: "Part-time", duration: "6 months" }
]
}5. Common Use Cases:
- E-commerce Platforms: Product catalogs with variable attributes, customer profiles, order histories
- Learning Management Systems: Student profiles, course enrollments, grades, attendance
- Content Management Systems: Articles with tags, comments, metadata
- Healthcare Records: Patient profiles, medical history, prescriptions
- IoT Systems: Device data, sensor readings, device metadata
- User Profile Management: Social media profiles, preferences, activity history
- Mobile Applications: User data, app settings, offline data
- Real-time Analytics: Event data, metrics, aggregated reports
Advantages of Document Database Paradigm:
- Developer Productivity: Documents map naturally to application objects
- Agile Development: Schema changes are easy to handle
- Performance: Related data stored together reduces joins
- Scalability: Designed for horizontal scaling
- Rich Data Types: Support for complex data structures
Limitations:
- No Standard Query Language: Different systems have