statusllka.blogg.se

Mongoose tutorial
Mongoose tutorial









mongoose tutorial mongoose tutorial mongoose tutorial

You must have MongoDB Installed or an account in the MongoDB Atlas cloud infrastructure of theirs to connect the database with mongoose or NodeJS.Models in our context will be just high-level functions that will take defined schema and create an instance of the MongoDB document.In NoSQL databases like MongoDB, we use key-value pairs inside a JSON object to store any particular data field, now inside each Document, there can be single or multiple data fields that contain some data.In SQL we know that there are columns and tables, in NoSQL databases like MongoDB there is no such thing so how do we store data? Well here we use something called Document, a Document is just a record stored inside Collection using a JSON object.When we study SQL we often deal with tables in the database, here we have collections, now a collection just means the group of documents stored all together.Database in MongoDB means the same as other SQL Languages but here we just store a set of collections so we can say a Database in MongoDB is just a group of collections having documents.We do know that MongoDB is a schema-less database but still, we need to define the schema of the application user using mongoose for validation purposes, schema just means the overall structure and how the data is organized in the database.Terminologies to Know Before Getting Started! Schema MongoDB is a very flexible database since it is a NoSQL Database, which works on the concept of storing documents as just JSON Objects, however, to perform basic schema validations and manage the data easily we would need a library like Mongoose to rescue us. Mongoose is an ODM(Object Data Modelling) Library made for NodeJS and MongoDB Database, it enables users to create and manage relationships between data by mapping objects from MongoDB to NodeJS and managing the schema validations for the data.











Mongoose tutorial