Category Archives: Mongo DB

MongoDB Database

Array Operator in MongoDB

The array operator in MongoDB is used to query for array fields. We’ve other fields type like String, Numeric and Boolean values. These are common types and have the same kind of implementation. But the Array is a little different than others. We will be learning common use cases and implementation of the Array operators here. Most frequently… Read More »

MongoDB: $expr Expressive Query Operator

$expr operator in MongoDB is an Expressive Query Operator. It does more than the single operator like $and and $or. It allows the use of aggregation expressions within the query language. The syntax of $expr operator is given below: It also allows us to use variables and conditional statements. Let’s see an example of this. In our previous… Read More »

Logical Operator in MongoDB

A logical operator is a word or a function that can be used to compare two or more expressions so that the compounded result will return the boolean value. MongoDB supports the standard set of four Logical Operators that we already know in our programming language like Java. Following are the available logical operators in MongoDB. Operator Description… Read More »

Comparison Operator in MongoDB

In this post, we will learn some comparison operator in MongoDB. The comparison operator in MongoDB can be used to return the data based on the value comparison in the fields. The equivalent of Java can be read in this post. The syntax of using the comparison operator in MongoDb is: The comparison operator in MongoDB are: Name… Read More »

Delete in MongoDB

In this post, we will learn to use the delete command in MongoDB. As we all know, having a delete functionality is very important in any system so that we can remove unwanted data when required. Delete MongoDB Collection To delete a collection in MongoDB we can use a drop() method. Syntax: Example: To delete a collection first… Read More »

Update MongoDB Document

In this post, we will learn to update a MongoDB Document. Update functionality is very important in every field so as in the MongoDB document. In MongoDB, we use the following two methods to update a MongoDB Document. updateOne() and updateMany() updateOne() MongoDB document The updateOne() method updates a single document that matches the filter criteria. The filter… Read More »

find() command in MongoDB

The find() command in MongoDB is used to find the data from the collection. There are various options for executing the find() command in MongoDB. In this post, we will be using these options along with the find() command. To execute the find() command we need to connect to our MongoDB server by using MongoShell. Instead of managing… Read More »

Import and Export in MongoDB

In this post, we will learn the different types of import and export commands in MongoDB. Let’s say we have data in our MongoDB database and want to keep a backup of it by exporting or we want to insert data into the MongoDB database by importing from an external file. In MongoDB, both options are possible. First,… Read More »

JSON and BSON in MongoDB

In this post, we will learn the difference between JSON and BSON in MongoDB. These two are document formats and they are widely used by developers in different use cases. In MongoDB, the data is stored in BSON and viewed in JSON. Instead of going directly to see the difference between JSON and BSON let’s understand both of… Read More »