06 MongoDB Flashcards

(32 cards)

1
Q

span_0“What does ‘NoSQL’ stand for in the context of MongoDB?”

A

The name is considered misleading; it generally refers to non-relational databases that don’t follow strict SQL schemasspan_0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

span_1“What are the main drawbacks of relational databases mentioned in the PDF?”

A

Constantly changing schemas, difficult data migrations, and performance/scalability issues due to strong consistencyspan_1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

span_2span_3“Describe the system architecture of MongoDB.”

A

A client uses a driver to communicate with the ‘mongod’ process via a ‘wire protocol’ using JSON format for data and queriesspan_2span_3.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

span_4“List the logical structure of MongoDB from largest to smallest unit.”

A

Cluster -> Database -> Collection -> Documentspan_4.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

span_5“What is a ‘Document’ in MongoDB?”

A

The basic unit of storage, containing key-value pairs in JSON/BSON format, limited to 16MBspan_5.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

span_6span_7“What is a ‘Collection’ analogous to in a relational database?”

A

A Tablespan_6span_7.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

span_8“What is the maximum size of a single MongoDB document?”

A

16MBspan_8.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

span_9span_10“What is the mandatory field in every MongoDB document?”

A

The _id fieldspan_9span_10.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

span_11“What are the components of a 12-byte ObjectId?”

A

4 bytes timestamp (seconds), 5 bytes random (node + process ID), and 3 bytes counterspan_11.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

span_12span_13“What is ‘Denormalization’ in MongoDB?”

A

The practice of nesting or embedding related data within a single document instead of using separate tables and joinsspan_12span_13.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

span_14“How should 1-1 connections typically be handled in MongoDB schema design?”

A

Through nesting (embedding sub-documents)span_14.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

span_15“How can 1-many connections be represented in MongoDB?”

A

Either as an array embedded within a document or as a reference to another document’s _idspan_15.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

span_16“What does BASE stand for in NoSQL transactions?”

A

Basically Available, Soft State, Eventual Consistencyspan_16.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: MongoDB supports ACID transactions.

A

True. span_17span_18While typical NoSQL uses BASE, MongoDB has supported ACID transactions since version 4.0span_17span_18.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

span_19“What is the performance impact of using distributed transactions in MongoDB?”

A

Performance degrades significantlyspan_19.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

span_20“Which NuGet package is used for MongoDB in .NET?”

17
Q

span_21“What does the [BsonId] attribute do in a C# class?”

A

It maps a specific property to the MongoDB ‘_id’ fieldspan_21.

18
Q

span_22“What does the [BsonElement(‘name’)] attribute do?”

A

It specifies the exact name of the field as it should appear in the MongoDB documentspan_22.

19
Q

span_23“What does the [BsonIgnore] attribute do?”

A

It tells the driver to skip that field when saving the object to the databasespan_23.

20
Q

span_24“What is a ‘Cursor’ in the context of querying?”

A

A way to process query results continuously rather than loading the entire list into memory at oncespan_24.

21
Q

span_25“What is the ‘Aggregation Pipeline’?”

A

A server-side process for multi-document operations like filtering, grouping, and countingspan_25.

22
Q

span_26“What is the equivalent of a ‘Left Outer Join’ in MongoDB aggregation?”

A

The $lookup functionspan_26.

23
Q

span_27“What is an ‘Upsert’ operation?”

A

An operation that updates a document if it matches a filter, or inserts a new one if no match is foundspan_27.

24
Q

span_28span_29“What is the difference between ReplaceOne and UpdateOne?”

A

ReplaceOne replaces the entire document with a new one (except ID), while UpdateOne modifies specific fieldsspan_28span_29.

25
[span_30](start_span)"What does the $inc operator do?"
Increases the value of a numeric field by a specified amount[span_30](end_span).
26
[span_31](start_span)"What does the $unset operator do?"
Deletes a specific field (key and value) from a document[span_31](end_span).
27
[span_32](start_span)"What does the $push operator do?"
Adds a value to the end of an array[span_32](end_span).
28
What is the difference between $push and $addToSet?
$push adds a value regardless of existence; [span_33](start_span)$addToSet only adds it if it doesn't already exist[span_33](end_span).
29
T/F: MongoDB database names are case-insensitive.
False. [span_34](start_span)Database names are case sensitive and typically lowercase[span_34](end_span).
30
T/F: Keys in a MongoDB document are case-sensitive.
True. [span_35](start_span)Document keys are case-sensitive[span_35](end_span).
31
T/F: You can define a compound primary key in MongoDB.
False. [span_36](start_span)There are no compound keys, but you can use compound indices[span_36](end_span).
32
T/F: A document key can begin with the '$' character.
False. [span_37](start_span)Keys cannot begin with the character $[span_37](end_span).