NoSQL and MongoDB Flashcards

1
Q

Problem with Relational Databases

A
  • Do not scale well to large clusters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Sharding

A
  • Divides up the rows of a collection of databases across multiple servers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Characteristics of NoSQL Databases

A
  • Don’t use the relational model
  • Open-source
  • Designed for clusters (sharding, fragmentation, replication)
  • Schema-less or flexible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Three Main Classes of NoSQL Databases

A
  • Key-value stores
  • Document databases
  • Column-family (big-table) stores
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Key-Value Stores

A
  • Queries are limited to the key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Document Stores

A
  • Values are not opaque
  • Queries can be based on the key or the contents
  • Support for sharding and replication
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Aggregate Orientation

A
  • Group together data that belongs together
  • Get related data without accessing many different nodes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Advantages of Schemalessness

A
  • Data types can evolve over time
  • Easier to handle nonuniform data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Disadvantages of Schemalessness

A
  • Can’t be enforced by DBMS
  • DBMS can’t make queries more efficient
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

MongoDB Equivalent of “Table”

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

MongoDB Equivalent of “Row”

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

MongoDB Equivalent of “Attributes”

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

MongoDB Equivalent of “Primary Key”

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

Capturing Relationships in MongoDB

A
  • Store references to other documents using their _id values
  • Embed documents within other documents
  • Use references if embedding could lead to significant growth in the size of the document over time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Limitations of MongoDB

A
  • A query can only access a single collection
  • Atomicity is only provided for operations on a single document
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

MongoDB Query Selection

A
  • db.collection.find(<selection>, <projection>)</projection></selection>
17
Q

MongoDB Single-Purpose Aggregation

A
  • db.collection.count(<selection>)</selection>
  • db.collection.distinct(<field>, <selection>)</selection></field>
18
Q

MongoDB Aggregation Pipeline

A
  • db.collection.aggregate({<pipeline-op1>: <pipeline-expression1>})</pipeline-expression1></pipeline-op1>
19
Q

MongoDB Pipeline Operations

A
  • $match
  • $group
  • $project
  • $unwind
  • $limit
  • $sort