Spring Data Mongo Pagination

In today’s post I would give you a sample program which loads data from MongoDb using Spring Data as page by page. This is useful when you load large data set into screen. The complete source code of this post can be found github. Libraries Use pom.xml

ProductRepository Source Code

Product Domain Object […]
Continue reading…


MongoDB – How to change the default port of mongodb?

By default mongodb instance run on port 27017.

There are two options to change the default port of mongodb. pass the –port argument when we start mongod. change the port in the mongodb.config file and pass the config file as input.

To connect to mongod running on port 19000 we need to start […]
Continue reading…


How to install MongoDB in Linux Mint?

There are four steps involved in instaling and testing MongoDB in Linux Mint. Download the MongoDB Server. Configure Data Folder. Start MongoDB. Start Mongo Shell Client. Download MongoDB Server. Make sure that the MongoDB is not installed in your machine before you download MongoDB. Open a shell and type mongod.

Shell will notify you […]
Continue reading…


How to save binary files into MongoDB using java driver?

MongoDB GridFS is a specification for storing large files. (16 MB or more) All MongoDB drivers support GridFS. GridFS split the file into many chunks and store each chunk in each document. GridFS stores documents in two collections. Chunk Collection. File Collection. The first collection stores the binary chunk and the second collection store the […]
Continue reading…


How to write orderby clause using MongoDB java drivers?

Today we will write a sample program using MongoDB java driver to sort a collection. Assume that we have a collection like this.

Sorting or ordering by a particular column is really simple using the console, The sort function takes column(s) name and order in which the sorting needs to be done. (-1 == […]
Continue reading…