Databases Flashcards

1
Q

One of the goals in web development is data __________.

A

persistence

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

Application processes stop at some point for 3 reasons:

A
  1. Hardware/software failure
  2. Need to upgrade or replace hardware
  3. Need to update software
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Data can be stored in (2):

A
  1. Flat files
  2. Databases
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A NoSQL, open-source document based database.

A

MongoDB

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

3 Features of MongoDB

A
  1. High Performance
  2. High Availability
  3. Easy Scalability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Working with _______ is commonplace in today’s programming languages.

A

objects

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

Why not save objects in the datastore in a similar format?

A

Sabi ni chatgpt:
1. Datastore Efficiency and Compatibility
In-memory objects often contain methods, type annotations, and references unsuitable for storage.

Datastores are optimized for simpler, serializable formats like JSON, BSON, or SQL rows.

  1. Serialization Requirements
    Data needs to be converted into a storable format (like maps or plain values). This process often drops non-serializable fields or complex types.
  2. Cross-Platform or Cross-Language Interoperability
    Saving data in a universal format (e.g., JSON) ensures that different clients (mobile, web, backend) can read it.
  3. Avoiding Redundancy or Circular References
    Object graphs in memory might have circular references or complex nesting. Flattening the structure avoids recursion and storage issues.
  4. Storage Constraints
    Some datastores (like Firebase Realtime Database or Firestore) have size limits or structural expectations that influence data shape.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Schema-less collections are good for _______________ data

A

semi-structured

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

MongoDB’s speed is good for applications requiring _____________ data.

A

real-time

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

Serve as the container for collections.

A

Databases

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

Contain documents and are schema-less

A

Collections

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

Units in MongoDB collections are JSON-like objects called ___________.

A

documents

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

In MongoDB, new documents are automatically assigned a primary key called ________.

A

_id

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

In version 3+ of MongoDB there is also a generated version key _____.

A

_v

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

The _v of a document is incremented after the execution of certain functions such as ______ or ____________.

A

save or findOneAndUpdate

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

Data relationships are supported using _______________ or _____________.

A

embedded documents or referenced documents

17
Q

MongoDB commands are centered around _________ which take the form of documents/JSON.

18
Q

_________ documents keep related data together.

19
Q

What is the advantage of embedded document?

A

Easier to query and update

20
Q

Disadvantage of embedded documents

A

Large embedded documents can impact read/write performance

21
Q

__________ documents take a normalized approach similar to Relational DBs.

A

Referenced

22
Q

Documents in other collections may reference them using an ___________.

A

Object ID or any identifying field

23
Q

Advantages of Referenced Documents

A
  1. Multiple documents can refer to the same external document
  2. Avoid the pitfalls of excessively large embedded documents.
24
Q

Disadvantage of Referenced Document

A

Require additional querying that many developers want to avoid

25
Reason why MongoDB features high performance.
Embedded documents reduces need for joins and multi-document queries on the database
26
Reason why MongoDB features high availability.
Supports replica sets
27
Reason why MongoDB features scalability.
Supports sharding: distribution of data across several machines
28
Before you can use data stored in databases, you have to ______________________.
convert it to a data structure your PL can understand
29
The process of converting data between systems of incompatible data types, using object-oriented methods.
Object Relational Mapping
30
The equivalent of ORM for NoSQL/Document-based databases.
Object Document Mapping
31
Provided an object-oriented way to access and manipulate the data in our DBs.
ORMs/ODMs
32
Mapping between some kinds of DBs comes with some _________.
data loss/overhead
33
Advantages of ORM/ODM
1. In-dept knowledge of the DB is not required for application development 2. DB querying optimization is independent from business logic 3. Underlying DB technology can easily be changed
34
One thing to make sure when using ORM
Use one that is being maintained
35
Which one to use? NoSQL vs SQL
Use NoSQL when: data is semi-structured and big and needs fast and easy querying Use SQL when your data has strict-structure and involves relationships and does not need fast querying