08 - Databases Flashcards

(35 cards)

1
Q

reasons for application processes to stop (3)

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
2
Q

data can be stored in two types

A
  1. flat files (txt, csv, binary)
  2. databases (sql, nosql, relational, document-based)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

an open-source document-based database (NoSQL)

A

mongodb

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

mongodb features (3)

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
5
Q

an alternative to Relational Database Management Systems in Web Applications

A

NoSQL DBs

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

schema-less collections are good for _____ data

A

semi-structured data

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

mongodb works with what type of data storage?

A

documents in collections

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

serves as the container for collections

A

database

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

contain documents and are schema-less

A

collections

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

true/false

several documents within the same collection can only contain the same set of fields

example:

a user can have a first name, middle name and last name, all other users must have all of the fields filled out (first name, middle name, last name)

A

false, it can be of different sets of fields

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

true/false

mongodb automatically assignes a primary key for new documents called _key

A

false, the primary key is labelled as _id

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

which version/s of mongodb is a version key generated for new documents

A

in version3+

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

the version key is incremented after the execution of which functions (2)

A

save or findOneAndUpdate

basically every update in the document

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

data relationships are supported using (2) types of documents

A
  1. embedded documents
  2. referenced documents
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

mongodb commands are centered around ____

A

queries in the form of documents/JSON

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

syntax for find command

A
db.<collectionName>.find(<query>)
db['collectionName'].find(<query>)
17
Q

syntax for update command

A
db.<collectionName>.find(
     <query>,
     <update>,
     <options>
)
18
Q

syntax for remove command

A
db.<collectionName>.remove(<query>)
19
Q

what type of document is this

{
    code: "CMSC100",
    students: 17,
    sections: [
            {section : "EF-1L"},
            {section : "EF-2L"}
    ]
}
A

embedded document, the section documents are embedded in the subject document

20
Q

advantage of using embedded documents

A

keeping related data in a single document makes it easy to query and update

21
Q

disadvantage of using embedded documents

A

extremely large embedded documents can impact read/write performance

22
Q

what type of document is this

{
    code: "CMSC100",
    students: 17,
    sections: [
            ObjectId("123456"),
            ObjectId("7891011")
    ]
}
A

referenced documents, the section documents are referenced inside a subject document through their object ids

23
Q

advantages of using referenced documents (2)

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

disadvantage of using referenced documents

A

requires additional querying that many developers want to avoid

25
support for embedded documents reduces need for joins and multi-document queries on the database
high performance
26
mongodb supports replica sets which provide redundancy
high availability
27
how does replica sets reduce downtime to nearly zero
mongodb supports replica sets, meaning a set or copy of the database is always available even when the administrator is pushing updates
28
mongodb supports sharding
scalability
29
what does sharding mean?
distribution of data across several machines
30
give the NoSQL term equivalent of the following: a. Database b. Table c. Row d. Column e. Table Join f. Primary Key
a. Database b. Collection c. Document d. Field e. Embedded Document f. Primary Key
31
true/false there is no need for you to convert data stored in databases to a data structure in order to use it
false, you need to convert it to a data structure your PL can understand
32
the process of converting data between systems of incompatible data types, using object-oriented methods
Object Relational Mapping
33
provides an object-oriented way to access and manipulate the data in our DBs
object relational mapping/object document mapping
34
equivalent NoSQL term of object relational mapping
object document mapping
35
advantages of using orm (3)
1. in-depth 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