Klasse DUUIMongoDBStorage
java.lang.Object
org.texttechnologylab.duui.api.storage.DUUIMongoDBStorage
A utility class for setting up and retrieving information about the database including its collections. Also
 contains utility methods for database operations.
- Autor:
- Cedric Borkowski
- 
MethodenübersichtModifizierer und TypMethodeBeschreibungstatic com.mongodb.client.MongoCollection<org.bson.Document> Utility functions for fast access to collections in the database.static voidconvertDateToTimestamp(org.bson.Document document, String fieldName) Convert a MongoDB date object to a timestamp.static org.bson.DocumentconvertObjectIdToString(org.bson.Document document) Replaces the ObjectID object by a plain text representation of the id called oid.static org.bson.DocumentconvertObjectIdToString(org.bson.Document document, String field, String newName) Replaces the ObjectID object by a plain text representation of the id.static com.mongodb.client.MongoCollection<org.bson.Document> Utility functions for fast access to collections in the database.static com.mongodb.client.MongoCollection<org.bson.Document> Events()Utility functions for fast access to collections in the database.static com.mongodb.client.MongoClientRetrieve the existingMongoClientor instantiate a new one.static StringRetrieve the connection URI to connect to aMongoClient.getFilterOrDefault(spark.Request request, String queryParameter) For a given filter queryParameter extract the string from the request query parameters (queryParameter=A;B;C;D...) and return aListof filter namesstatic com.mongodb.client.MongoCollection<org.bson.Document> Globals()Utility functions for fast access to collections in the database.static voidInject theConfigfor the application and initialize a.Ungültige Referenzcom.mongodb.MongoClientstatic com.mongodb.client.MongoCollection<org.bson.Document> Utility functions for fast access to collections in the database.static com.mongodb.client.MongoCollection<org.bson.Document> Utility functions for fast access to collections in the database.static voidRefactor all connections in the database to the new structure.static voidupdateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates) static voidupdateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates, boolean skipInvalid) Combine a Document containing key value pairs representing an update action into a merged BSON object.static com.mongodb.client.MongoCollection<org.bson.Document> Users()Utility functions for fast access to collections in the database.
- 
Methodendetails- 
convertObjectIdToStringpublic static org.bson.Document convertObjectIdToString(org.bson.Document document) Replaces the ObjectID object by a plain text representation of the id called oid.- Parameter:
- document- The document to convert.
 
- 
convertObjectIdToStringpublic static org.bson.Document convertObjectIdToString(org.bson.Document document, String field, String newName) Replaces the ObjectID object by a plain text representation of the id.- Parameter:
- document- The document to convert.
- field- The name of the ObjectId field. Usually _id.
- newName- The new name of the field. Usually oid.
 
- 
convertDateToTimestampConvert a MongoDB date object to a timestamp.- Parameter:
- document- The document containing the date.
 
- 
getConnectionURIRetrieve the connection URI to connect to aMongoClient.- Gibt zurück:
- The connection URI.
 
- 
getClientpublic static com.mongodb.client.MongoClient getClient()Retrieve the existingMongoClientor instantiate a new one.- Gibt zurück:
- A MongoClientinstance.
 
- 
initInject theConfigfor the application and initialize a.Ungültige Referenzcom.mongodb.MongoClient- Parameter:
- config- the configuration for the application.
 
- 
refactorAllConnectionspublic static void refactorAllConnections()Refactor all connections in the database to the new structure.
- 
Pipelinespublic static com.mongodb.client.MongoCollection<org.bson.Document> Pipelines()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
Componentspublic static com.mongodb.client.MongoCollection<org.bson.Document> Components()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
Userspublic static com.mongodb.client.MongoCollection<org.bson.Document> Users()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
Documentspublic static com.mongodb.client.MongoCollection<org.bson.Document> Documents()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
Processsespublic static com.mongodb.client.MongoCollection<org.bson.Document> Processses()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
Eventspublic static com.mongodb.client.MongoCollection<org.bson.Document> Events()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
Globalspublic static com.mongodb.client.MongoCollection<org.bson.Document> Globals()Utility functions for fast access to collections in the database.- Gibt zurück:
- A MongoCollection object.
 
- 
updateDocumentpublic static void updateDocument(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.conversions.Bson filter, org.bson.Document updates, Set<String> allowedUpdates, boolean skipInvalid) Combine a Document containing key value pairs representing an update action into a merged BSON object.- Parameter:
- collection- The collection on which to perform the update
- filter- A set of filters so that only matching documents are updated.
- updates- The Document containing the updates.
- allowedUpdates- A Set of field names that are allowed to be updated.
- skipInvalid- Wether to skip invalid keys or return when encountered. Default true.
 
- 
updateDocument
- 
getFilterOrDefaultFor a given filter queryParameter extract the string from the request query parameters (queryParameter=A;B;C;D...) and return aListof filter names- Parameter:
- request- the request object.
- queryParameter- the queryParameter of the query parameter
- Gibt zurück:
- a list of Strings to filter by.
 
 
-