-----Mongo DB-----
- Open Source document db
- NoSQL Database
- Collection used to hold documents
- Document : set of key-value pair JSON, dynamic schema ----RDBMS------ ----MONGODB-----------
- Database Database
- Table Collection
- Tuple/Row Document
- Column Field
- Primary Key _id key (12 bytes hexadecimal number)
-
Advantages of MongoDB
- Schemaless
- Faster
- Scalable
-------Mongoose : ODM Library---------
-
Object Data Modelling Library for MongoDB And Nodejs
-
Used to translate between object in node app and representation of those object in MongoDB
-
Define Schema/structure for storing documents in a collection
- Schema type (String,Number,Boolen)
- Option (required,defualt...)
-
Create Model similar to collection where we can store documents
-
Install mongoose : npm i mongoose
-
Define connection between mongoDb and Node using mongoose
- create folder in server : DB folder
- Create a js file to define connection
- import mongoose