I find that in larger teams and more stable products, it is better to have a strict or semi-strict schema. Using Object Document Mapping libraries such as mongoose alleviates this problem.
JavaScript Based
MongoDB's language is JavaScript.
For relational databases, we had a query language called SQL. For MongoDB, the query language is based on JSON. You create, search for, make changes, and delete documents by specifying the operation in a JSON object. The query language is not English-like (Not like SQL SELECT or WHERE) and therefore much easier to construct programmatically.
Data is also interchanged in JSON format. In fact, the data is natively stored in a variation of JSON called BSON (where B stands for Binary) in order to efficiently utilize space. When you retrieve a document from a collection, it is returned as a JSON object.
MongoDB comes with a shell that's built on top of a JavaScript runtime like Node.js. This means that you have a powerful and familiar scripting language (JavaScript) to interact with the database via command line. you can also write code snippets in JavaScript that can be saved and run on the server(equivalent of stored procedures)
Tools and Libraries
it's hard to build any web application without using tools to help you on your way. Here's a brief introduction to the other tools apart from the MERN stack components that we will be using to develop the sample application in this book.
React-Router
React gives us only the view rendering capability and helps manage interactions in a single component. when it comes to transitioning between different views of the component and keeping the browser URL in sync with the current state of the view, we need something more.
This capability of managing URLs and history is called routing. it is similar to server-side routing that Express does: a URL is parsed and bsed on its components, a piece of code is associated with the URL. React-Router not only does this, but also manages the browser's Back button functionality so that we can transition between what seem as pages without loading the entire page from server.
网友评论