Open
Description
Working on a legacy code base, we've got lots of code that builds up aggregations including lookups, so we want to lookup the collection name for a class.
We've got an implementation that I'm guessing was at some point copied from mongo, but doesn't seem up to date and digging through code can assume it was copied from
BasicMongoPersistentEntity
public BasicMongoPersistentEntity(TypeInformation<T> typeInformation) {
super(typeInformation, MongoPersistentPropertyComparator.INSTANCE);
Class<?> rawType = typeInformation.getType();
String fallback = MongoCollectionUtils.getPreferredCollectionName(rawType);
if (this.isAnnotationPresent(Document.class)) {
Document document = this.getRequiredAnnotation(Document.class);
this.collection = StringUtils.hasText(document.collection()) ? document.collection() : fallback;
this.language = StringUtils.hasText(document.language()) ? document.language() : "";
this.expression = detectExpression(document.collection());
this.collation = document.collation();
this.collationExpression = detectExpression(document.collation());
} else {
this.collection = fallback;
this.language = "";
this.expression = null;
this.collation = null;
this.collationExpression = null;
}
Is there any reason this isn't exposed as a static method call so anyone can resolve class name to collection name consistently with how mongo does it?