Mod 6 Flashcards
What is a database management system?
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
What are relational database management systems?
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.
What are document oriented database management systems?
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.
Which database management system uses SQL and which is associated with NoSQL?
- 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.
What format does MongoDB store data in?
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
What are the 3 layers in MVC?
MVC stands for Model-View-Controller.
What is the purpose of the Model Layer?
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.
What is the purpose of the view layer?
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.
What is the purpose of the controller layer?
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
What is an object-document mapper (ODM)?
an object-document mapper (ODM) maps between classes and objects in our JavaScript code and the documents or tables in our database.
How can we perform CRUD operations using Mongoose?
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.
What is the schema concept in Mongoose?
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..