General Flashcards
What is MongoDB?
MongoDB is a NoSQL database program that uses JSON-like documents with optional schemas.
What is a NoSQL database?
A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.
How does MongoDB store data?
MongoDB stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time.
What is a collection in MongoDB?
A collection is a group of MongoDB documents. It is the equivalent of an RDBMS table, but it doesn’t enforce any structure.
What is a document in MongoDB?
A document is a record in a MongoDB collection, similar to a row in a table of an RDBMS.
What is the purpose of BSON in MongoDB?
BSON (Binary JSON) is a binary-encoded serialization of JSON-like documents. It supports more data types than JSON.
How does MongoDB handle indexing?
MongoDB supports various types of indexes including single field, compound, multikey, geospatial, text, hashed, clustered (>= v5.3) indexes.
What is sharding in MongoDB?
Sharding is the process of storing data records across multiple machines to ensure horizontal scalability.
What is replication in MongoDB?
Replication is the process of synchronizing data across multiple servers to provide redundancy and high availability.
What is a replica set in MongoDB?
A replica set is a group of MongoDB instances that maintain the same data set, providing redundancy and high availability.
What are the advantages of using MongoDB over relational databases?
Advantages include a flexible schema design, easier scalability, high performance for certain types of workloads, and simpler management of large datasets.
What are the disadvantages of MongoDB?
Disadvantages include the potential for increased complexity in certain scenarios, less mature tooling compared to relational databases, and specific use cases where relational databases might be more efficient.
What is the Aggregation Framework in MongoDB?
The Aggregation Framework is a set of operations that process data records and return computed results. It provides a way to transform and combine data.
What is a primary key in MongoDB?
In MongoDB, the primary key is automatically set to the _id field in each document. Each document’s _id must be unique within a collection.
How does MongoDB ensure ACID transactions?
MongoDB ensures ACID transactions at the document level and, starting with version 4.0, it supports multi-document transactions to provide atomicity, consistency, isolation, and durability across multiple documents.