LBRY Block Explorer

LBRY Claims • 02-create-a-model-mongodb-and-mongoose

c95a6e901b50fe5a97df4080538ff028ce61b120

Published By
Created On
25 Jun 2021 17:21:27 UTC
Transaction ID
Cost
Safe for Work
Free
Yes
02 - Create a Model - MongoDB and Mongoose - freeCodeCamp Tutorial
We have to create a Schema and a Model before we can write to the database. A Scheme defines a set of properties and types that our records will have. We can then use the Schema to create a 'Model' which can represent a real life entity like a Person.

Link to challenge : https://www.freecodecamp.org/learn/apis-and-microservices/mongodb-and-mongoose/create-a-model
Written Guide : https://www.notion.so/ganeshh123/Create-a-Model-b105d83e622c4377ae234d1be1e1d3f7

Full Playlist for this course : https://www.youtube.com/playlist?list=PLhGp6N0DI_1QJMb63oecYZ3lLjrF4PnIs
All Writen Guides for this course : https://www.notion.so/ganeshh123/6f987e7260914612b06adf840dbb00c3
All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganesh-H-293ea420d34a464f9a1907e0405b5f26

Concepts:
Schema
You can think of a Mongoose schema as the configuration object for a Mongoose model. Each schema maps to a MongoDB collection and defines the shape of the documents within that collection. You construct one, giving an object with key value pairs with properties and types the collection should have.
https://mongoosejs.com/docs/guide.html

Model
Models are fancy constructors compiled from Schema definitions. An instance of a model is called a document. Models are responsible for creating and reading documents from the underlying MongoDB database.
https://mongoosejs.com/docs/models.html

mongoose.model()
When you call mongoose.model() on a schema, Mongoose compiles a model for you. The first argument is the singular name of the collection your model is for. Mongoose automatically looks for the plural, lowercased version of your model name.
https://mongoosejs.com/docs/models.html#compiling

 -————————————————————————————————————-
MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL).

Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js. It manages relationships between data, provides schema validation, and is used to translate between objects in code and the representation of those objects in MongoDB.

freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project t
...
https://www.youtube.com/watch?v=MYdGwi1glko
Author
Content Type
Unspecified
video/mp4
Language
English
Open in LBRY

More from the publisher

Controlling
VIDEO
08 -
Controlling
VIDEO
15 -
Controlling
VIDEO
02 -
Controlling
VIDEO
01 -
Controlling
VIDEO
04 -
Controlling
VIDEO
016 -
Controlling
VIDEO
10 -
Controlling
VIDEO
RESET
Controlling
VIDEO
HOW C