Posts

Showing posts with the label MongoDB

Spring Boot – MongoRepository

Introduction Spring Boot is a powerful framework that simplifies the development of Java applications. It offers a wide range of features and tools to make building robust and scalable applications easier. One of the key components of Spring Boot is the support for data access and persistence. In this blog post, we will explore the use of Spring Boot with MongoDB, a NoSQL database, and specifically, how to use the `MongoRepository` interface to interact with MongoDB. Why MongoDB and Spring Boot? MongoDB is a popular NoSQL database that stores data in a flexible, JSON-like format known as BSON (Binary JSON). It is well-suited for applications with rapidly evolving schemas and complex data structures. When combined with Spring Boot, MongoDB becomes a powerful choice for developing data-driven applications. Using Spring Boot with MongoDB offers several advantages: 1. Rapid Development: Spring Boot's auto-configuration and convention-over-configuration approach enable developers to...

How To Run Mongodb In Docker With Username and Password | Java Inspires

Image
How To Run Mongodb In Docker With Username and Password | Java Inspires In this post, we will see how to run mongodb in docker with username and password. First we will run without username and password. Command: $ docker run --name local-mongo -p 27017:27017 -d mongo Connect to DB using Robo3T Stop and remove container $ docker container ls $ docker container stop <containerId> $ docker container rm <containerId> Run mongo with username and password. Command: $ docker run --name local-mongo -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password -d mongo Connect to DB using Robo3T Thats it .... THANK YOU... Power Shell Log: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https : //aka.ms/pscore6 PS C : \Users\developer> docker images REPOSITORY TAG IMAGE ID CREATED SIZE mongo latest 4253856b2570 2 weeks ago 701MB PS C : \User...

How to deploy mongodb image in docker? Connect to DB using ROBO3T.

Image
In this post, we will see How to deploy mongodb image in docker? and Connect to DB using ROBO3T. Open PowerShell 1, Check whether mongo image is there or not. $ docker image inspect mongo 2, Pull mongodb latest image from docker $ docker pull mongo:latest $ docker image ls 3, Run mongo image in detached mode on port 27017. $ docker run --name local-mongo -p 27017:27017 -d mongo 4, Check running containers. $ docker container ls 5, Open Mongo container logs. $  docker container logs <containerId> -f 6, Open Robo3T and connect to localhost:20172. 7, Stop running container. $ docker container stop <containerId> 8, Remove stopped container. $ docker container ls -a $ docker container rm <containerId> 9, Delete mongo image. $ docker image ls $ docker image rm -f <ImageId> 10, Check whether mongo image is there or not $ docker image inspect mongo Log: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform Po...