Connect MongoDB Atlas Cluster Using Shell

In this post, we will learn to connect the MongoDB Atlas cluster using a shell command from our local machine. To connect a cluster we must have: A cluster is created in Atlas. If you haven’t created it already you … Read More

Create Cluster In MongoDB Atlas

In this post, we will learn to create a cluster in MongoDB Atlas. We will not learn what is MongoDB Atlas and why we need it in this post. So. let’s start creating a cluster directly. Steps to create a … Read More

Search In MongoDB Using Java

In this post, we will learn to implement a search query in MongoDB using Java. Most of the applications have search functionality. So, learning to use it will be very useful. 1. Prerequisite 2. SQL query example This query fetches … Read More

What is MongoDB?

MongoDB is an Open Source and cross-platform NoSQL Document Database. It was developed by MongoDB Inc. MongoDB is the most popular NoSQL database out there. It is a widely used database. MongoDB is a general-purpose document database. It structures the … Read More

Mapping MongoDB Document to POJO Class in Java

In this post, we will learn to map directly from org.bson.Document object to Java POJO or Java Bean. By default, MongoDB Java Driver maps MongoDB collection document to org.bson.Document object. 1. Employee document sample 2. Insert employee document with BSON … Read More

MongoCollection in Spring Boot

In this post, we will learn to use a MongoCollection instance for database operations in the Spring Boot application. We all know that we have a spring boot data repository for MongoDB which has an interface MongoRepository and a class … Read More

Logging MongoDB Queries in Java?

In this post, we will learn to enable logging MongoDB queries in Java. For this example, we need a MongoDB driver for Java. To display the query in the log we need to set the org.mongodb.driver level to debug.

MongoDB useful commands

Create User Connect mongodb by typing mongo Switch to admin database by typing use admin Create user and password with appropriate role. Like following Then disconnect from MongoDb shell by typing Ctl+D Enable authentication Open /etc/mongod.conf with your favorite editor … Read More

How to check if field exists in MongoDb?

In MongoDB, we can check whether the field exists or not in two different ways: Ignore field using $exists operator Let’s say we have a collection called users and we want to query documents where the age field is exist … Read More

Install MongoDB BI Connector in Ubuntu

Introduction MongoDB BI Connector is a connector that allows you to use MongoDB as a data source for SQL-based BI (Business Intelligence) and visualization tools. It allows you to connect your BI tools, such as Tableau, to a MongoDB database … Read More