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

A

64mb

24
Q

Create hashed index

A

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

25
Q

Components of ObjectId

A

Date
Machine identifier
Process ID
Counter

26
Q

Aggregation pipeline stage memory limit

A

100MB

27
Q

Allow aggregation pipeline to use more than 100MB

A

{allowDiskUse:true}

28
Q

MMAPv1 concurrency level

A

Collection level locking

29
Q

WiredTiger concurrency level

A

Document level concurrency

30
Q

WiredTiger compression levels

A

Snappy and zlib

31
Q

What causes MMAPv1 document movement?

A

Document outgrows it’s allocated space

32
Q

MMAPv1 document movement causes?

A

Indexes that point to file location to be updated

33
Q

Disable power of two allocation

A

Db.runCommand( { “collMod” : , “noPadding”: true } ):

34
Q

MMAPv1 max file size

A

2047MB

35
Q

Manually split db.test chunk with number 3 into equal sized chunks

A

sh.splitFind(“db.test”, { “number”: 3}):

36
Q

Split db.test AT number 3

A

sh.splitAt( “db.test”, { “number”: 3 });

37
Q

What causes an election

A

Initiating replica set, and primary becoming unavailable

38
Q

Rolled back data goes where?

A

Rollback/ folder in data path

39
Q

What causes rollback?

A

Data written to primary but not a secondary after primary failure

40
Q

Ensure data is written to most nodes

A

{w: “majority”}

41
Q

Ensure data is written to the journal

A

{j: true}

42
Q

What causes an election

A

Initiating replica set, and primary becoming unavailable

43
Q

Rolled back data goes where?

A

Rollback/ folder in data path

44
Q

Will update update a field to the same value?

A

No, it will skip it

45
Q

Can you update the _id field?

A

No, it is immutable

46
Q

By default, update will update how many documents?

A

1

47
Q

By default, remove will remove how many documents?

A

All of them.

48
Q

Remove just one document

A

Db.collection.remove({},{justOne:true);

49
Q

Update more than one document

A

db.collection.update({col:”cond”},{multi: true});

50
Q

Read preference choices

A
Primary
primaryPreferred
secondary
secondaryPreferred
nearest
51
Q

Find all from testData collection with nearest read preference

A

db.testData.find().readPref(“nearest”);