Skip to main content

Posts

Showing posts with the label MongoDB

Part-1 | NestJS(v9) | ReactJS(v18) | MongoDB | CRUD Example

The main objectives of this article are: NestJS And ReactJS Application Communication. NestJS. Create NestJS Application. Debug The NestJS Application From Visual Studio Code. ReactJS Create ReactJS Applicaiton Install React Bootstrap Add React Bootstrap Menu. NestJS And ReactJS Application Communication: The user request the ReactJS application(single page application) then js files are downloaded and then runs the application on the browser. Since ReactJS is a single-page application it depends on API for data to display. So ReactJS request the NestJS endpoint through HTTP requests. NestJS API that runs at the server gives the JSON response. NestJS API communicates with the database for fetching and storing the data. NestJS: NestJS is a framework used to develop the server-side application. NestJS is built on top of the Node.js framework just like Express. It is a combination of Progressive Javascript, Object-Oriented Programming, Functional Programming, and Functional Reactive P

.NET6 Web API CRUD Operation With MongoDB

In this article, we are going to implement .NET6 Web API CRUD operation using MongoDB as database. MongoDB: MongoDB is a source-available cross-platform document-oriented database. It is also called a NoSQL database or Non-Relational database. In MongoDB 'Collection' is equivalent to the Table in SQL database. In MongoDB data is stored as 'Document' that is equivalent to a table record in an SQL database. The 'Document' contains JSON data which will be stored in BSON(Binary JSON) format. Create A .NET6 Web API Application: Let's create a .Net6 Web API sample application to accomplish our demo. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands) to create any.Net6 application. For this demo, I'm using the 'Visual Studio Code'(using the .NET CLI command) editor. CLI command dotnet new webapi -o Your_Project_Name MongoDB Docker Image: In this demo, I will consume the MongoDB that's run as a Docker container.

A Demo On MongoDB Running On Docker And Visual Studio Code MongoDB Extension PlayGround

In this article, we are going to understand MongoDB along with its Docker Composer and its Visual Studio Code extension playground. MongoDB: MongoDB is a source-available cross-platform document-oriented database. It is also called a NoSQL database or Non-Relational database. In MongoDB 'Collection' is equivalent to the Table in SQL database. In MongoDB data is stored as 'Document' that is equivalent to a table record in an SQL database. The 'Document' contains JSON data which will be stored in BSON(Binary JSON) format. MongoDB Docker Composer: Let's implement docker-compose to create a MongoDB docker container. (Step 1): Download and install the 'Docker Desktop' application. The application should be in running mode. (Step 2): Add a new folder for our MongoDB docker composer. Then add the file like 'docker-compose.yml'. docker-compose.yml: version: '3.8' services: mongodb: image: mongo:5.0 volumes: - ./mongo/dat

NestJS Multiple MongoDB Databases Accessing Sample Code

Introduction: Most of the case's applications are going to communicate with more than one database. Here I'm going to walk through with sample NestJS application which communicates with multiple MongoDB's.  Click here to know more about NestJS API CRUD using MongoDB . MongoDB Atlas: MongoDB Atlas is a cloud database. It has all the options of creating a MongoDB instance like for Free MongoDB Instance(for learning), Paid MongoDB Instance(for production). To illustrate multiple MongoDB connections for sample application here I'm going to use this Cloud MongoDB Atlas. It is fairly minimal steps involved for created a Cloud MongoDB instance. Note: It is not mandatory to use the cloud based MongoDb database. You can use either locally installed instances like Mongo Shell, MongoDb Compass. Create Sample NestJS Application: NestJS provides CLI which helps to create a boilerplate templated application to getting started NestJS CLI command: np

NestJS API CRUD Operations With MongoDB

Introduction: NestJS is a framework used to develop server-side applications. NestJS built on top of Node.js frameworks like Express. It is a combination of Progressive Javascript, Object-Oriented Programming, Functional Programming, and Functional Reactive Programming. Nest CLI Installation: Using Nest CLI we are able to generate the NestJS starter project with the default template. To install Nest CLI globally over our system open command prompt and run the command               npm i -g @nestjs/cli Now create a sample project by using Nest CLI command              nest new your_project_name package.json: Now open the package.json file from the sample application created, you can observe few properties like "scripts", "dependencies", and "devDependencies". "dependencies" contains all plugins to be installed and used them to run the application. "devDependencies" contain all plugins to be installed and used them