MongoDB Flashcards

1
Q

Atomicity _________ isolation durability

A

Consistency

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

Atomicity consistency ___________ durability

A

Isolation

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

____________ consistency isolation durability

A

Atomicity

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

Atomicity consistency isolation ____________

A

Durability

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

ACID

A

Atomicity consistency isolation durability

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

.explain() Verbosity levels

A

queryPlanner
executionStats
allPlansExecution

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

____________
executionStats
allPlansExecution

A

queryPlanner

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

queryPlanner
_______________
allPlansExecution

A

executionStats

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

queryPlanner
executionStats
________________

A

allPlansExecution

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

Create index in background

A

{background:true}

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

Create text index

A

{field:”text”}

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

Default write concern

A

w:1

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

Enable sharding

A

sh.enableSharding(‘collection’)

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

Shard collection

A

sh.shardCollection(‘collection’, {shard:key});

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

Get shard status

A

sh.status();

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

Add shard to cluster

A

sh.addShard(‘rs/server:port’);

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

Create time to live TTL index

A

{expireAfterSeconds:360}

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

List indexes

A

db.collection.getIndexes();

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

Remove index

A

db.collection.dropIndex({index:signature});

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

Add to replica set

A

rs.add(“hostname:port”);

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

Shard query that hits a single shard

A

Targeted query

22
Q

Shard query that hits all nodes

A

Scatter gather or broadcast query

23
Q

Default chunk size

24
Q

Create hashed index

A

db.col.createIndex( { col: “hashed”});

25
Components of ObjectId
Date Machine identifier Process ID Counter
26
Aggregation pipeline stage memory limit
100MB
27
Allow aggregation pipeline to use more than 100MB
{allowDiskUse:true}
28
MMAPv1 concurrency level
Collection level locking
29
WiredTiger concurrency level
Document level concurrency
30
WiredTiger compression levels
Snappy and zlib
31
What causes MMAPv1 document movement?
Document outgrows it's allocated space
32
MMAPv1 document movement causes?
Indexes that point to file location to be updated
33
Disable power of two allocation
Db.runCommand( { "collMod" : , "noPadding": true } ):
34
MMAPv1 max file size
2047MB
35
Manually split db.test chunk with number 3 into equal sized chunks
sh.splitFind("db.test", { "number": 3}):
36
Split db.test AT number 3
sh.splitAt( "db.test", { "number": 3 });
37
What causes an election
Initiating replica set, and primary becoming unavailable
38
Rolled back data goes where?
Rollback/ folder in data path
39
What causes rollback?
Data written to primary but not a secondary after primary failure
40
Ensure data is written to most nodes
{w: "majority"}
41
Ensure data is written to the journal
{j: true}
42
What causes an election
Initiating replica set, and primary becoming unavailable
43
Rolled back data goes where?
Rollback/ folder in data path
44
Will update update a field to the same value?
No, it will skip it
45
Can you update the _id field?
No, it is immutable
46
By default, update will update how many documents?
1
47
By default, remove will remove how many documents?
All of them.
48
Remove just one document
Db.collection.remove({},{justOne:true);
49
Update more than one document
db.collection.update({col:"cond"},{multi: true});
50
Read preference choices
``` Primary primaryPreferred secondary secondaryPreferred nearest ```
51
Find all from testData collection with nearest read preference
db.testData.find().readPref("nearest");