Allow for a raw Mongo collection to be passed to Mongo repos
This commit is contained in:
parent
e8f3b45c68
commit
2ec91e3dcf
@ -37,8 +37,12 @@ public class MongoRepository<ID, E> extends Repository<MongoDB, ID, E> {
|
||||
@NonNull private final MongoCollection<Document> collection;
|
||||
|
||||
public MongoRepository(@NonNull MongoDB database, @NonNull Class<? extends E> entityClass, @NonNull String collectionName) {
|
||||
this(database, entityClass, database.getDatabase().getCollection(collectionName));
|
||||
}
|
||||
|
||||
public MongoRepository(@NonNull MongoDB database, @NonNull Class<? extends E> entityClass, @NonNull MongoCollection<Document> collection) {
|
||||
super(database, entityClass);
|
||||
collection = database.getDatabase().getCollection(collectionName); // Get the collection by the name
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user