Tag Archives: mongo java

working with Mongo db + Java (subcollections)

In the previous post we have seen different ways to use find() method. Today lets check out different operations we can perform on Sub Collections. Index: Creating a sub Collection in Collection Adding Objects to sub collections Updating sub collection … Continue reading

Posted in mongodb | Tagged , , , | Leave a comment

Basic CRUD Operations on MongoDB + Java

In previous Post , we have seen 5 ways to connect to Mongo DB , now perform CRUD operations on Mongo DB using Java Driver 3.2. Dependency Needed: Add the above dependency in the maven project. To Insert One Document … Continue reading

Posted in mongodb | Tagged , , , | 1 Comment

5 ways to connect to MongoDB

I have been working on Mongo java 2.x driver , Recently we planned to update our Java driver version to 3.x.  Then i got realized that a lot has been changed. Now lets start working on Mongo-Java-Driver 3.2 version. Depenedency: … Continue reading

Posted in mongodb | Tagged , , , , | 1 Comment

Best Tutorials for MongoDB

MongoDB is a document oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on concept of collection and document. I have been working on MongoDB lately, are you one like me? or are you playing with … Continue reading

Posted in mongodb | Tagged , , , , , , , , , , | Leave a comment

Basics of Java mongodb

Mongo Db Java Driver :  Total 33 packages. Com.mongodb is the core package. Com.mongdb.util  –> has the classes that can be used in anywhere , basically utilty classes Com.mongdb.util.JSON –> one of the mose useful class. It contains the helper  methods to serialese and desericalze the data. Methods:  It has 4 methods among i am takeing 2 here Static Object parse(String jsonData) –> parses json string and returns the  corresponding java object. Static String serialize(Object object) –> serialize a object into json form. Note: JsonParseException — > exception that is thrown when invalid JSON encountered while  parsing the json.    Com.mongodb.annotations  –>  has the  annotations that can be apply any part of the  driver classes There are 4 annotations , they are @Beta  –>signifies that public api is subjected to change, or removal in future. @Immutable –> The class which this annotation is applied is Immutable. @NotThreadSafe —> The class which this annotation is applied is not thread safe. @ThreadSafe –> the class which this annotation is applied is thread safe.   Basic building blocks of mongoDB java driver   Cursor : … Continue reading

Posted in mongodb | Tagged , , , , , , | Leave a comment