Java code for Mongo DB