I am using mongo db driver 2.11.2. I am bit puzzled how to insert/add an array to the BasicDBObject. All the example which I come across are does not show how to achieve this :(. In the below example how would I insert employees array in the dbo object ?
/*
{
"company" : "stackoverflow",
"established": "when I started coding"
"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]
}
*/
BasicDBObject basicDBObject = new BasicDBObject();
basicDBObject.put("company", "stackoverflow");
basicDBObject.put("established", "when I started coding");
System.out.println(basicDBObject.toString());
}