MongoDB upsert example using Mongo Shell and Java Driver

MongoDB upsert option is used with update method which creates a new document if the query does not retrieve any documents satisfying the criteria. The default value for this option is false. The upsert option….

MongoDB distinct Query

MongoDB distinct method returns a set of discrete values for the field specified as the input argument. Mongo distinct method returns an array of discrete values. MongoDB distinct The syntax for MongoDB distinct method is….

MongoDB exists example using Mongo Shell and Java Driver

This checks the document for the existence of the fields in the specified collection. The syntax is { field: { $exists: <boolean> } } The operator accepts the boolean values of either true or false…..

MongoDB Bulk Insert – MongoDB insertMany

We will look into MongoDB bulk insert today. Multiple documents can be inserted at a time in MongoDB using bulk insert operation where an array of documents is passed to the insert method as parameter…..

MongoDB sort

MongoDB sort method sorts the document in either ascending or descending order as specified by the user in the input argument. MongoDB sort The syntax for MongoDB sort method is: { $sort:{<field1>:<sort order>……..}} sort order….

MongoDB findAndModify() example

MongoDB findAndModify() method modifies and returns a single document based upon the selection criteria entered. The returned document does not show the updated content by default. If the records matching the criteria does not exist….

MongoDB findOne Example

MongoDB findOne() method returns only one document that satisfies the criteria entered. If the criteria entered matches for more than one document, the method returns only one document according to natural ordering, which reflects the….

MongoDB find()

There are two ways to find an item from the MongoDB database. One is through MongoDB find method and the other is through findOne method. Let’s go through find() method first from the shell and….

How to Install MongoDB on Windows, Start, Uninstall

Today we will learn how to install MongoDB on Windows. Most of us use Windows for our personal use. That’s why I am writing this tutorial to help you install MongoDB on Windows. We will….

MongoDB update

MongoDB update is used to update document in a collection. In last tutorial, we learned about MongoDB insert with Mongo Shell and Java driver. Today we will look into MongoDB update and different options provided….

Generic selectors
Exact matches only
Search in title
Search in content