Package org.graylog2.database
Class MongoCollections
java.lang.Object
org.graylog2.database.MongoCollections
-
Constructor Summary
ConstructorsConstructorDescriptionMongoCollections(MongoJackObjectMapperProvider objectMapperProvider, MongoConnection mongoConnection) -
Method Summary
Modifier and TypeMethodDescription<T extends MongoEntity>
com.mongodb.client.MongoCollection<T>collection(String collectionName, Class<T> valueType) Get a MongoCollection configured to use Jackson for serialization/deserialization of objects.<T> com.mongodb.client.MongoCollection<T>Deprecated.<T> com.mongodb.client.MongoCollection<T>nonEntityCollection(String collectionName, Class<T> valueType) Get a MongoCollection for document types that don't implementMongoEntity.<T extends MongoEntity>
MongoPaginationHelper<T>paginationHelper(com.mongodb.client.MongoCollection<T> collection) Provides a helper to perform find operations on a collection that yield pages of documents.<T extends MongoEntity>
MongoPaginationHelper<T>paginationHelper(String collectionName, Class<T> valueType) Provides a helper to perform find operations on a collection that yield pages of documents.<T extends ScopedEntity>
ScopedEntityMongoUtils<T>scopedEntityUtils(com.mongodb.client.MongoCollection<T> collection, EntityScopeService entityScopeService) Provides utility methods for creating, updating, and deleting ScopedEntity objects<T extends MongoEntity>
MongoUtils<T>utils(com.mongodb.client.MongoCollection<T> collection) Provides utility methods like getting documents by ID, etc.<T extends MongoEntity>
MongoUtils<T>Provides utility methods like getting documents by ID, etc.
-
Constructor Details
-
MongoCollections
@Inject public MongoCollections(MongoJackObjectMapperProvider objectMapperProvider, MongoConnection mongoConnection)
-
-
Method Details
-
get
@Deprecated public <T> com.mongodb.client.MongoCollection<T> get(String collectionName, Class<T> valueType) Deprecated.Usecollection(String, Class)ornonEntityCollection(String, Class)instead.Get a MongoCollection configured to use Jackson for serialization/deserialization of objects.Prefer using
collection(String, Class)to get a more strictly typed collection! -
nonEntityCollection
public <T> com.mongodb.client.MongoCollection<T> nonEntityCollection(String collectionName, Class<T> valueType) Get a MongoCollection for document types that don't implementMongoEntity.Prefer using
collection(String, Class). Only use this method if, for some reason, the document class cannot implement theMongoEntityinterface.- Parameters:
collectionName- Name of the collectionvalueType- Java type of the documents stored in the collection- Returns:
- A collection using a Jackson codec for serialization and deserialization
-
collection
public <T extends MongoEntity> com.mongodb.client.MongoCollection<T> collection(String collectionName, Class<T> valueType) Get a MongoCollection configured to use Jackson for serialization/deserialization of objects.- Parameters:
collectionName- Name of the collectionvalueType- Java type of the documents stored in the collection- Returns:
- A collection using a Jackson codec for serialization and deserialization
-
paginationHelper
public <T extends MongoEntity> MongoPaginationHelper<T> paginationHelper(String collectionName, Class<T> valueType) Provides a helper to perform find operations on a collection that yield pages of documents. -
paginationHelper
public <T extends MongoEntity> MongoPaginationHelper<T> paginationHelper(com.mongodb.client.MongoCollection<T> collection) Provides a helper to perform find operations on a collection that yield pages of documents. -
utils
Provides utility methods like getting documents by ID, etc. -
utils
public <T extends MongoEntity> MongoUtils<T> utils(com.mongodb.client.MongoCollection<T> collection) Provides utility methods like getting documents by ID, etc. -
scopedEntityUtils
public <T extends ScopedEntity> ScopedEntityMongoUtils<T> scopedEntityUtils(com.mongodb.client.MongoCollection<T> collection, EntityScopeService entityScopeService) Provides utility methods for creating, updating, and deleting ScopedEntity objects
-
collection(String, Class)ornonEntityCollection(String, Class)instead.