}
private static Object serializeUpdateField(Object value,
JsonSerializer serializer, SerializerProvider serializerProvider,
String op, String field) {
BsonObjectGenerator objectGenerator = new BsonObjectGenerator();
try {
serializer.serialize(value, objectGenerator, serializerProvider);
} catch (IOException e) {
throw new MongoJsonMappingException(
"Error serializing value in DBUpdate operation " + op
+ " field " + field, e);
}
return objectGenerator.getValue();
}