MongoDB

The Shell

mongosh //to start

use college //to create & use a new database called "college"


difference


Collections

Document : Mongo stores data in form of documents (BSON docs)

Collection : MongoDB stores documents in collections.


MongoDB CRUD Operations




Query and Projection Operators


Update Methods





Mongoose

A library that creates a connection between MongoDB & Node.js JavaScript Runtime Environment.

It is an ODM (Object Data Modeling) Library.


NPM mongoose

mongoose documantation






vese multiple insert generally nahi karte ha, kyuki api request

Note:-

Mongoose uses Operation Buffering
Mongoose lets you start using your models immediately, without waiting for mongoose to establish a connection to MongoDB.









Validation in updation & errors:-

schema me jo rule define kiye the wo sirf insertion ke time kam karega, updation me nahi

eske liye jugar hai- refer to documentation


0 Comments