Class 03 reading - Data Modeling & NoSQL Databases
JS data modeling
- to manipulate something, you first need to know (define) what it is
- JS has only the 5 main datatypes (obj, arr, str, num, bool)
- best practices are common but not mandatory
- bool for only 2 states
- num when arithmetic operators might happen
- str for language
- arr for bundled data
- obj for many layers of bundled data
CRUD
- Create
- Read
- Update
- Delete
Interfaces and Services - the ‘Repository’ design pattern
- services connect the operation to the data source (whatever it may be)
Implementation
- implementation is the means of interating with the persistence layer (file, mongo, postgres)
Normalization and Validation
- sanity check data before operating it to ensure proper format
NoSQL database
- ‘norma/tradtional’ DBs like postgres, sql server, oracle are ‘relational’ (store in rows and columns) and link records via keys
- use a special language to access data
- noSql -> document storage based. Rather than data spread across records, it’s all in 1 record (like a doc page)
- typically they are pure json, no real structure.
- good for ‘read-heavy’ usage and frequent aggregations
-noSql data modeling
-Cloud Databases
–There are a few alternatives to running Mongo locally for your web servers
- MLab - remotely hosted mongoDB systems. Easily setup a free database (or pay for more horsepower). Works great with Heroku
- Atlas - Cloud based, highly scalable Mongo DB
- DynamoDB - AWS NoSQL Database. Very highly scalable. Also provides a ‘mongoose’-like ORM called ‘dynamoose’
- CosmosDB - The Microsoft Azure equivalent for Atlas and Dynamo
Videos