Mod 6 Flashcards

1
Q

What is a database management system?

A

A database management system (DBMS) is the software used to manage databases. Many times, when the context is clear, the term database is used for DBMS as well. A DBMS supports efficient CRUD (create, read, update, delete) operations on large volumes of data. Another important feature that DBMSs provide is the concurrent execution of CRUD operations for a large number of users

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

What are relational database management systems?

A

Relational DBMS, such as Oracle, SQL Server, PostgreSQL, MySQL, etc., are the most common types of DBMS in current use.

  • In a relational DBMS, data is organized as tables.
  • The columns of a table define the data type of the data that can be stored in that table.
  • The rows of a table store the actual values corresponding to that column.
  • Relational DBMS technology is very mature with decades of research and development.
    Over the years, standards have been defined for relational technology.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are document oriented database management systems?

A

Document-oriented DBMS, such as MongoDB, Amazon’s DocumentDB, Couchbase, Google’s Firestore, are comparatively new. These DBMS have gained some popularity starting around 2005.

  • In a document-oriented DBMS, also simply called a document DBMS, data is stored as a document in a format such as JSON or XML.
  • Documents that are somewhat similar are added to the same collection.
  • A document corresponds to a row in a relational DBMS, while a collection corresponds to a table.
  • A property of a document corresponds to a column in a table.
  • Most document DBMS do not require that the data type of properties should match across the different documents stored in the same collection.
  • There are not many widely used standards for document DBMS. Switching from one document database to another can be a steep curve.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which database management system uses SQL and which is associated with NoSQL?

A
  • Relational DBMS support a standard query language called SQL (Structured Query Language). SQL provides support for all CRUD operations on tables, as well as support for creating, updating and dropping tables. There are only minor variations in the SQL syntax across different DBMS, which again makes it easy to transfer your knowledge of developing applications for one relational DBMS to developing apps for another relational DBMS.
  • Document DBMS started out as explicitly rejecting SQL and were associated with a movement termed NoSQL DBMS. CRUD operations were, and continue to be, supported via functions provided by the document DBMS. However, over time many document DBMS recognized the usefulness of query languages and many now support some form of query language. However, the lack of standardization means that the query languages of different document DBMS can vary a lot.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What format does MongoDB store data in?

A

The format of documents in MongoDB closely resembles JSON. More specifically, MongoDB internally stores documents in a format called BSON, which is a binary form of JSON. But the MongoDB API exposes the documents as JSON and the JSON format makes it very easy to use MongoDB in Node programs

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

What are the 3 layers in MVC?

A

MVC stands for Model-View-Controller.

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

What is the purpose of the Model Layer?

A

Model
The model of an app corresponds to the layer that manages the application’s data. In apps developed using languages with support for object-orientation, the model will include:

  • Classes in the app that represent the data in the database.
  • Code that maps the data in the database to these classes and maps the classes to the data in the database.
  • For example, in MongoDB data is represented as documents.
  • The model layer will be responsible
  • For mapping from the MongoDB documents to JavaScript objects
  • For mapping the JavaScript objects to MongoDB documents
  • Code that executes CRUD operations on the DBMS.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the view layer?

A

View
The view is the layer of the app that displays data from the app. In a web app, the view is ultimately rendered in HTML and CSS. In a desktop app, the view will be rendered using a UI toolkit for the platform on which the app is running. The view does not directly interact with the model. Instead, it will send information about a user’s interaction with the view to the controller.

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

What is the purpose of the controller layer?

A

Controller
The controller is the layer of the app that connects the view to the model. The controller handles requests from the view layer. It determines how to process the request. It decides how to involve the view and model layer in processing the request, including how the view and the model might be updated due to the request.

In an Express app, the controller layer is implemented by the route handlers. The route handlers:

Receive requests
Call functions to perform CRUD operations on the model layer
Send back responses that update the view

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

What is an object-document mapper (ODM)?

A

an object-document mapper (ODM) maps between classes and objects in our JavaScript code and the documents or tables in our database.

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

How can we perform CRUD operations using Mongoose?

A

Following the MVC Pattern, we will have a Model and Controller Layer. To execute CRUD (create, retrieve, update, delete) operations on a collection in MongoDB, Mongoose provides a large number of static methods on the model class generated by Mongoose for a schema. We can use theses methods in the model layer to perform the 4 CRUD operations. Route handlers in the controller layer that call the appropriate function in the model later as an HTTP request can then be added for each CRUD operation.

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

What is the schema concept in Mongoose?

A

In Mongoose, a schema represents the properties of a collection in MongoDB. We define a schema by calling the method Schema on the mongoose object.

  • For each property, we specify the data type.
  • Data typesLinks to an external site. (formally called Schema Types), include String, Number, Boolean, Date, Array, and Map (key-value pairs), among others types.
  • We can specify certain constraints on individual properties. These are called schema type optionsLinks to an external site..
How well did you know this?
1
Not at all
2
3
4
5
Perfectly