Week 6 L1 Flashcards

1
Q

What is embedding and referencing ?

A

MongoDB does not support FK referencing of PK, there is no join operator.
Embedded object is implicitly joined
Referencing is controlled by application

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

What is one collection embedding ?

A

when embedded object not used independently of its parent object . Generally known as data aggregation.

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

Advantages of one collection embedding?

A

Provides performance advantage
Associated data is held in one document
data access by single command

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

What is single association embedding?

A

employee works on exactly one machine. Embedding one document in another. Embedded object no longer independent .

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

Advantages of Single Association embedding

A

everything in one place. makes updates very efficient

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

What is multiple association embedding

A

Multiple child objects embedded in one parent object. makes it difficult to insert child objects independent of parent.

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

When does multiple association embedding work well ?

A

Works well when the zero one or many relationships are few .

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

How to access document embedded fields?

A

Use dot notation

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

What is two collections referencing ?

A

Two collections used independently. requires two steps or join to retrieve related data from collections
application must control the referencing between documents

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

Advantages of two collections referencing

A

More flexible than embedded

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

What is single association referencing ?

A

Closest to the relational design solution
Employee works on exactly one machine
Allows objects to be independent

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

How do you reference?

A

update collection by add id reference into other object

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

How to reference across collection?

A

Use a loop with a cursor

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

What are alternatives to he join method ?

A

$lookup

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

What is multiple association referencing

A

0 one or many relationships.

Two collections with an array of references

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

Advantages of multiple association referencing

A

works well if many is limited to hundreds so doc size limit is not exceeded. this keeps fields independent so easy to search and update.

17
Q

How to reference arrays ?

A

$in

18
Q

What are more elaborate database designs?

A

partial redundancy : copy name/make into both employee and machine
Two-way referencing: both objects reference each other .
Two way embedding: wholesale redundancy
Read vs Write trade-offs

19
Q

What is client side processing?

A

Processing on client side rather than database server side

20
Q

What are manual refs ?

A

id field of one document copied in another document as reference

21
Q

What are DB refs ? give examples operators

A

referencing across collections or databases , state database and collection and doc id. $ref, $id, $db

22
Q

When would you use referencing in no sql ? give examples

A

Write once , read lots .

e.g. online shopping, social media posts

23
Q

Advantages with NoSQL?

A

Write on massive scale
Reads very fast ( providing database is indexed and shared properly.
Storage is cheap and scalable.

Embedding data in single document instead of joining many tables makes retrieval faster

24
Q

Disadvantages of NoSQL

A

No referential integrity
Few server side joins
not as good for normalised model.