There are three different ways to insert a document in a collection using Java Driver :
1) com.mongodb.BasicDBObject - Create the new object and keep on appending the fields into the object
2) com.mongodb.BasicDBObjectBuilder - Static method "start()" returns the new instance of the class. Add fields into the object and "get()" method of the class returns the DBObject object that can be inserted into a collection.
3) java.util.Map - Create a Map object and put the values in key, value fashion. Add them into a collection
Java Example :