mongoose3 [TIL] 20201221 Data Relationships With Mongo Mongo Relationships We usually have a lot of data and they are interconnected to each other. SQL Relationships Overview Have independent tables and they reference each other to have relationships. To keep up with Many to Many relationships, it is common to create another table that only references other tables. One to Few Embed the data directly in the document Example { name : 'Tommy Cash', sav.. 2020. 12. 21. [TIL] 20201219 Handling Errors in Express Apps Express' Built-In Error Handler Responds with default 500 status code HTML response Custom Error Handlers Error-handling functions have four arguments (err, req, res, next) Example app.use(function(err, req, res, next) { console.error(err.stack); res.status(500).send('Something Broke'); //default error doesn't work anymore. } If you pass anything to the next() function, Express regards the curre.. 2020. 12. 19. [TIL] 20201217 MongoDB / Mongoose Database Why Use DB DB can handle large amounts of data effectively and store it compactly. DB provide tools for easy insertion, querying, and updating of data. DB generally offer security features and control over access to data. DB (generally) scale well. SQL vs. NoSQL Databases SQL NoSQL Structured Query Language Do not use SQL. (Newer, diverse group) Relational DB : Can relate tables, often .. 2020. 12. 17. 이전 1 다음