Tech

HomeTech

Sharding and Horizontal Scaling in MongoDB

Table of Contents Introduction to Sharding and Horizontal Scaling Why Horizontal Scaling is Important for MongoDB Sharding Architecture in MongoDB Shard Key Config Servers Mongos Setting Up Sharding in MongoDB How MongoDB...

Backup and Restore in MongoDB (mongodump, mongorestore)

Table of Contents Introduction to MongoDB Backup and Restore Why Backup and Restore are Crucial in MongoDB mongodump: Backing Up MongoDB Data What is mongodump? How to Use mongodump Options...

― Advertisement ―

spot_img

Schema Definition and Validation with Mongoose

Table of Contents Introduction to Mongoose Schema Defining a Mongoose Schema Mongoose Schema Types Setting Default Values Mongoose Validation Built-in Validation Custom Validation Async Validation Validating Arrays and Nested Objects Required Fields and Field...

More News

MongoDB with Mongoose ORM

Table of Contents Introduction to Mongoose What is an ORM (Object Relational Mapping)? Setting Up Mongoose Defining Mongoose Models CRUD Operations Using Mongoose Create (insertOne, insertMany) Read (findOne, find) Update (updateOne, updateMany) Delete...

CRUD Operations in Node.js with MongoDB (with Code Examples)

Table of Contents Introduction What is CRUD? Setting Up the Project Connecting to MongoDB Create Operation (insertOne, insertMany) Read Operation (findOne, find) Update Operation (updateOne, updateMany) Delete Operation (deleteOne, deleteMany) Error Handling &...

MongoDB with Node.js Using the Official Driver

Table of Contents Introduction Why Use the Official MongoDB Driver? Installing MongoDB Driver for Node.js Connecting to MongoDB (Local and Atlas) CRUD Operations with the MongoDB Driver Using Connection Pooling Error...

Explore more

Handling Input Validation and Auth in GraphQL in NestJS

GraphQL allows for flexible and efficient data querying, but managing input validation and authentication within your GraphQL API requires specific strategies. NestJS provides powerful...

Resolvers, Queries, Mutations, and Subscriptions in NestJS

GraphQL enables you to interact with your data by defining a schema that specifies the types, queries, mutations, and subscriptions. The key component that...

Setting Up GraphQL with Code-First and Schema-First Approaches in NestJS

GraphQL is a query language for APIs that allows clients to request exactly the data they need, making it an efficient alternative to RESTful...

Working with Background Jobs using Bull and Redis in NestJS

Background jobs are crucial for offloading resource-intensive tasks, such as email sending, image processing, or data synchronization, from the main request-response cycle. Bull, a...

Using Event Emitters and Async Event Handling in NestJS

Event-driven architecture is a powerful design pattern that promotes loose coupling, scalability, and better organization of logic. In NestJS, you can leverage the built-in...

Redis Pub/Sub with WebSockets for Scalable Messaging in NestJS

As your real-time application grows, a single WebSocket server may not be able to handle all clients efficiently. In a distributed system where multiple...

Building a Chat App with Gateway, Rooms, and Events in NestJS

Real-time chat applications are a perfect use case for WebSockets. In this module, we'll build a basic chat app using NestJS WebSocket Gateways, Socket.IO...

WebSockets in NestJS with @nestjs/websockets

In the modern web, real-time communication is increasingly becoming a necessity. Whether it's a live chat app, real-time analytics dashboard, multiplayer game, or stock...

Middleware vs Guard for Auth Handling in NestJS

When building secure applications with NestJS, authentication plays a central role. Two common mechanisms used for request-level processing are Middleware and Guards. Both can...

Using Sessions and Cookies in NestJS: Persistent Login and Secure State Management

While JWTs are a popular method for authentication in modern APIs, sessions and cookies remain a secure and viable solution — especially in traditional...

Role-Based Access Control (RBAC) and Guards in NestJS

Controlling access to resources based on user roles is a fundamental security practice in modern application development. In NestJS, Guards offer a clean and...

Refresh Tokens and Token Rotation in NestJS: Secure JWT Authentication

As you build secure applications with NestJS and JWT authentication, one critical concern is token expiration. Access tokens should have short lifespans for security,...