return null;
}
if (isEnabled(Feature.USE_STREAM_SERIALIZATION)) {
return new JacksonDBObject<T>(object);
} else {
BsonObjectGenerator generator = new BsonObjectGenerator();
try {
objectMapper.writeValue(generator, object);
} catch (JsonMappingException e) {
throw new MongoJsonMappingException(e);
} catch (IOException e) {
// This shouldn't happen
throw new MongoException("Unknown error occurred converting BSON to object", e);
}
return generator.getDBObject();
}
}