public final class MongoDbConnection extends Object implements NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>
NoSqlConnection.| Constructor and Description |
|---|
MongoDbConnection(com.mongodb.DB database,
com.mongodb.WriteConcern writeConcern,
String collectionName) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying connection.
|
MongoDbObject[] |
createList(int length)
Creates an array of the specified length typed to match the
NoSqlObject implementation appropriate for
this provider. |
MongoDbObject |
createObject()
Instantiates and returns a
NoSqlObject instance whose properties can be configured before ultimate
insertion via NoSqlConnection.insertObject(NoSqlObject). |
void |
insertObject(NoSqlObject<com.mongodb.BasicDBObject> object)
Inserts the given object into the underlying NoSQL database.
|
boolean |
isClosed()
Indicates whether the underlying connection is closed.
|
public MongoDbConnection(com.mongodb.DB database, com.mongodb.WriteConcern writeConcern, String collectionName)
public MongoDbObject createObject()
NoSqlConnectionNoSqlObject instance whose properties can be configured before ultimate
insertion via NoSqlConnection.insertObject(NoSqlObject).createObject in interface NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>NoSqlObjectpublic MongoDbObject[] createList(int length)
NoSqlConnectionNoSqlObject implementation appropriate for
this provider.createList in interface NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>length - the length of the array to create.NoSqlObjectpublic void insertObject(NoSqlObject<com.mongodb.BasicDBObject> object)
NoSqlConnectioninsertObject in interface NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>object - The object to insert.public void close()
NoSqlConnectionIf this connection is part of a connection pool, executing this method should commit the transaction and return the connection to the pool, but it should not actually close the underlying connection.
close in interface Closeableclose in interface AutoCloseableclose in interface NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>public boolean isClosed()
NoSqlConnectiontrue if a call to NoSqlConnection.insertObject(NoSqlObject) will fail due to the state of this object.isClosed in interface NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>true if this object is considered closed.Copyright © 1999-2021 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.