@Test
public void updateMongoDocument() throws Exception {
MongoQueryOptions mongoQueryOptions = new MongoQueryOptions();
mongoQueryOptions.addQuery((BasicDBObject) JSON.parse("{'$match': {'label': 'tete'}}"));
MongoCollection mongoCollection = new MongoCollection("dummyCollection", "test");
MongoCollectionResult initialData = mongoManager.loadCollectionValues(serverConfiguration, mongoCollection, mongoQueryOptions);
Assert.assertEquals(1, initialData.getMongoObjects().size());
DBObject initialMongoDocument = initialData.getMongoObjects().get(0);
initialMongoDocument.put("price", 25);
mongoManager.update(serverConfiguration, mongoCollection, initialMongoDocument);
MongoCollectionResult updatedResult = mongoManager.loadCollectionValues(serverConfiguration, mongoCollection, mongoQueryOptions);
List<DBObject> updatedMongoDocuments = updatedResult.getMongoObjects();
Assert.assertEquals(1, updatedMongoDocuments.size());
DBObject updatedMongoDocument = updatedMongoDocuments.get(0);
Assert.assertEquals(25, updatedMongoDocument.get("price"));
}