template.requestBody("direct:insert", body);
}
assertEquals(100L, testCollection.count());
// Testing the update logic
DBObject extraField = new BasicDBObject("extraField", true);
assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
assertEquals("Number of records with 'scientist' field = Darwin on must equal 0", 0, testCollection.count(new BasicDBObject("scientist", "Darwin")));
DBObject updateObj = new BasicDBObject("$set", new BasicDBObject("scientist", "Darwin"));
Object result = template.requestBodyAndHeader("direct:update", new Object[] {extraField, updateObj}, MongoDbConstants.MULTIUPDATE, true);
assertTrue(result instanceof WriteResult);
assertEquals("Number of records with 'scientist' field = Darwin on must equal 50 after update", 50,