Class MongoDbConnection
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.nosql.AbstractNoSqlConnection<org.bson.Document,MongoDbDocumentObject>
-
- org.apache.logging.log4j.mongodb3.MongoDbConnection
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,NoSqlConnection<org.bson.Document,MongoDbDocumentObject>
public final class MongoDbConnection extends AbstractNoSqlConnection<org.bson.Document,MongoDbDocumentObject>
The MongoDB implementation ofNoSqlConnection
.
-
-
Constructor Summary
Constructors Constructor Description MongoDbConnection(com.mongodb.MongoClient mongoClient, com.mongodb.client.MongoDatabase mongoDatabase, java.lang.String collectionName, boolean isCapped, java.lang.Integer sizeInBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeImpl()
MongoDbDocumentObject[]
createList(int length)
Creates an array of the specified length typed to match theNoSqlObject
implementation appropriate for this provider.MongoDbDocumentObject
createObject()
Instantiates and returns aNoSqlObject
instance whose properties can be configured before ultimate insertion viaNoSqlConnection.insertObject(NoSqlObject)
.void
insertObject(NoSqlObject<org.bson.Document> object)
Inserts the given object into the underlying NoSQL database.-
Methods inherited from class org.apache.logging.log4j.core.appender.nosql.AbstractNoSqlConnection
close, isClosed
-
-
-
-
Method Detail
-
closeImpl
public void closeImpl()
- Specified by:
closeImpl
in classAbstractNoSqlConnection<org.bson.Document,MongoDbDocumentObject>
-
createList
public MongoDbDocumentObject[] createList(int length)
Description copied from interface:NoSqlConnection
Creates an array of the specified length typed to match theNoSqlObject
implementation appropriate for this provider.- Parameters:
length
- the length of the array to create.- Returns:
- a new array.
- See Also:
NoSqlObject
-
createObject
public MongoDbDocumentObject createObject()
Description copied from interface:NoSqlConnection
Instantiates and returns aNoSqlObject
instance whose properties can be configured before ultimate insertion viaNoSqlConnection.insertObject(NoSqlObject)
.- Returns:
- a new object.
- See Also:
NoSqlObject
-
insertObject
public void insertObject(NoSqlObject<org.bson.Document> object)
Description copied from interface:NoSqlConnection
Inserts the given object into the underlying NoSQL database.- Parameters:
object
- The object to insert.
-
-