MongoDB Guide
MongoDB Guide
a) Handling Routes
Routing determines how an application responds to client requests. A route defines a URL pattern
Example:
b) Route Parameters
Example:
c) Query Parameters
Query parameters are key-value pairs appended to the URL after a question mark.
Example:
i) Helmet Middleware
Helmet is an Express.js middleware that enhances security by setting HTTP headers.
Example:
app.use(helmet());
Example:
body
background-color #f5f5f5
a) MongoDB Structure
Example:
"_id": ObjectId("605c72d1f3a1c4b7f0a21c5b"),
"age": 30
}
b) MongoDB Architecture
1. Sharded Cluster
2. Replication Set
3. Mongos Router
4. Config Servers
Example:
use myDatabase
db.users.find()
a) Creating a Database:
use myDatabase
b) Creating a Collection:
db.createCollection("users")
c) Deleting a Collection:
db.users.drop()
d) Deleting a Database:
db.dropDatabase()