I want to create the following document schema in mongoDB using the java driver
{ \"_id\": { \"$oid\": \"513e9820c5d0d8b93228d7e8\" }, \"suitename\
You can create an ArrayList which takes in DBObjects.
List array = new ArrayList();
Add the created DBObject for the object inside the array and add it to the array object created.
array.add(/* some object */);
Finally, put the array in the main document object.
document.put("milestones", array);