Class MongoDriver
java.lang.Object
de.caluga.morphium.driver.mongodb.MongoDriver
- All Implemented Interfaces:
MorphiumDriver,Closeable,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.caluga.morphium.driver.MorphiumDriver
MorphiumDriver.DriverStatsKey -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddClusterListener(com.mongodb.event.ClusterListener cl) voidaddCommandListener(com.mongodb.event.CommandListener cmd) voidaddConnectionPoolListener(com.mongodb.event.ConnectionPoolListener cpl) aggregate(AggregateMongoCommand settings) aggregate(String db, String collection, List<Map<String, Object>> pipeline, boolean explain, boolean allowDiskUse, Collation collation, com.mongodb.ReadPreference readPreference) voidclose()voidvoidvoidconnect()voidlongcount(CountMongoCommand settings) longcount(String db, String collection, Map<String, Object> query, Collation collation, com.mongodb.ReadPreference rp) <T,R> Aggregator<T, R> createAggregator(Morphium morphium, Class<? extends T> type, Class<? extends R> resultType) createBulkContext(Morphium m, String db, String collection, boolean ordered, WriteConcern wc) voidcreateIndex(String db, String collection, Doc index, Doc options) intdelete(DeleteMongoCommand settings) delete(String db, String collection, Doc query, Map<String, Integer> sort, boolean multiple, Collation collation, WriteConcern wc) distinct(DistinctMongoCommand settings) distinct(String db, String collection, String field, Doc filter, Collation collation, com.mongodb.ReadPreference rp) drop(DropMongoCommand settings) voiddrop(String db, WriteConcern wc) voiddrop(String db, String collection, WriteConcern wc) dropDatabase(DropMongoCommand settings) longestimatedDocumentCount(String db, String collection, com.mongodb.ReadPreference rp) booleanbooleanfind(FindCommand settings) find(String db, String collection, Doc query, Map<String, Integer> sort, Doc projection, int skip, int limit, int batchSize, com.mongodb.ReadPreference readPreference, Collation collation, Doc findMetaData) findAndModify(FindAndModifyMongoCommand settings) findAndOneAndDelete(String db, String col, Doc query, Map<String, Integer> sort, Collation collation) findAndOneAndReplace(String db, String col, Doc query, Doc replacement, Map<String, Integer> sort, Collation collation) findAndOneAndUpdate(String db, String col, Doc query, Doc update, Map<String, Integer> sort, Collation collation) intcom.mongodb.client.MongoCollection<org.bson.Document>getCollection(com.mongodb.client.MongoDatabase database, String collection, com.mongodb.ReadPreference readPreference, WriteConcern wc) com.mongodb.client.MongoCollection<org.bson.Document>getCollection(String db, String coll) getCollectionStats(String db, String coll, int scale, boolean verbose) getCollStats(String db, String coll) intString[]getCredentials(String db) com.mongodb.client.MongoDatabasegetDBStats(String db) intbooleanintintintgetIndexes(String db, String collection) intintintintintintintintintintintintintgetName()getOps(long threshold) intintintintvoidheartBeatFrequency(int t) initAggregationIteration(String db, String collection, List<Map<String, Object>> aggregationPipeline, com.mongodb.ReadPreference readPreference, Collation collation, int batchSize, Doc findMetaData) initIteration(String db, String collection, Doc query, Map<String, Integer> sort, Doc projection, int skip, int limit, int batchSize, com.mongodb.ReadPreference readPreference, Collation collation, Doc findMetaData) voidinsert(InsertMongoCommand settings) voidbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisUseSSL()listCollections(String db, String pattern) mapReduce(MapReduceCommand settings) mapReduce(String db, String collection, String mapping, String reducing, Doc query, Doc sorting, Collation collation) voidvoidremoveClusterListener(com.mongodb.event.ClusterListener cl) voidremoveCommandListener(com.mongodb.event.CommandListener cmd) voidremoveConnectionPoolListener(com.mongodb.event.ConnectionPoolListener cpl) runCommand(String db, Doc cmd) voidsetAtlasUrl(String atlasUrl) voidsetConnectionTimeout(int timeout) voidsetConnectionUrl(String connectionUrl) voidsetCredentials(String db, String login, String pwd) voidsetCredentials(Map<String, String[]> credentials) voidvoidsetDefaultBatchSize(int defaultBatchSize) voidsetDefaultFsync(boolean j) voidsetDefaultJ(boolean j) voidsetDefaultReadPreference(com.mongodb.ReadPreference defaultReadPreference) voidvoidsetDefaultW(int w) voidsetDefaultWriteTimeout(int wt) voidsetHeartbeatFrequency(int heartbeatFrequency) voidsetHostSeed(String... host) voidsetHostSeed(List<String> seed) voidsetLocalThreshold(int thr) voidsetMaxBsonObjectSize(int maxBsonObjectSize) voidsetMaxConnectionIdleTime(int time) voidsetMaxConnectionLifetime(int timeout) setMaxConnections(int maxConnections) voidsetMaxConnectionsPerHost(int maxConnectionsPerHost) voidsetMaxMessageSize(int maxMessageSize) voidsetMaxWaitTime(int maxWaitTime) voidsetMaxWriteBatchSize(int maxWriteBatchSize) setMinConnections(int minConnections) voidsetMinConnectionsPerHost(int minConnectionsPerHost) voidsetMongo(com.mongodb.client.MongoClient mongo) voidsetReadTimeout(int readTimeout) voidsetReplicaSet(boolean replicaSet) voidsetReplicaSetName(String replicaSetName) setRetriesOnNetworkError(int retriesOnNetworkError) setRetryReads(boolean retryReads) setRetryWrites(boolean retryWrites) voidsetServerSelectionTimeout(int serverSelectionTimeout) setSleepBetweenErrorRetries(int sleepBetweenErrorRetries) voidsetSslContext(SSLContext sslContext) voidsetSslInvalidHostNameAllowed(boolean sslInvalidHostNameAllowed) voidvoidsetUseSSL(boolean useSSL) voidsetUuidRepresentation(String uuidRepresentation) voidstartTransaction(boolean autoCommit) voidtailableIteration(String db, String collection, Doc query, Map<String, Integer> sort, Doc projection, int skip, int limit, int batchSize, com.mongodb.ReadPreference readPreference, int timeout, DriverTailableIterationCallback cb) update(UpdateMongoCommand settings) update(String db, String collection, Doc query, Map<String, Integer> sort, Doc op, boolean multiple, boolean upsert, Collation collation, WriteConcern wc) voiduseSsl(boolean ssl) voidwatch(WatchCommand settings) voidwatch(String db, int maxWaitTime, boolean fullDocumentOnUpdate, List<Map<String, Object>> pipeline, DriverTailableIterationCallback cb) voidwatch(String db, String collection, int maxWaitTime, boolean fullDocumentOnUpdate, List<Map<String, Object>> pipeline, DriverTailableIterationCallback cb)
-
Field Details
-
driverName
- See Also:
-
-
Constructor Details
-
MongoDriver
public MongoDriver()
-
-
Method Details
-
isReplicaset
public boolean isReplicaset()- Specified by:
isReplicasetin interfaceMorphiumDriver
-
createAggregator
public <T,R> Aggregator<T,R> createAggregator(Morphium morphium, Class<? extends T> type, Class<? extends R> resultType) - Specified by:
createAggregatorin interfaceMorphiumDriver
-
setCredentials
- Specified by:
setCredentialsin interfaceMorphiumDriver
-
startTransaction
- Specified by:
startTransactionin interfaceMorphiumDriver
-
isTransactionInProgress
public boolean isTransactionInProgress()- Specified by:
isTransactionInProgressin interfaceMorphiumDriver
-
aggregate
-
count
-
watch
- Specified by:
watchin interfaceMorphiumDriver
-
distinct
-
mapReduce
-
delete
-
find
-
findAndModify
-
insert
-
update
-
drop
-
dropDatabase
-
getAtlasUrl
-
setAtlasUrl
-
listDatabases
- Specified by:
listDatabasesin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
addCommandListener
public void addCommandListener(com.mongodb.event.CommandListener cmd) -
removeCommandListener
public void removeCommandListener(com.mongodb.event.CommandListener cmd) -
addClusterListener
public void addClusterListener(com.mongodb.event.ClusterListener cl) -
removeClusterListener
public void removeClusterListener(com.mongodb.event.ClusterListener cl) -
addConnectionPoolListener
public void addConnectionPoolListener(com.mongodb.event.ConnectionPoolListener cpl) -
removeConnectionPoolListener
public void removeConnectionPoolListener(com.mongodb.event.ConnectionPoolListener cpl) -
listCollections
- Specified by:
listCollectionsin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
getReplicaSetName
- Specified by:
getReplicaSetNamein interfaceMorphiumDriver
-
setReplicaSetName
- Specified by:
setReplicaSetNamein interfaceMorphiumDriver
-
getDefaultBatchSize
public int getDefaultBatchSize()- Specified by:
getDefaultBatchSizein interfaceMorphiumDriver
-
getMaxBsonObjectSize
public int getMaxBsonObjectSize()- Specified by:
getMaxBsonObjectSizein interfaceMorphiumDriver
-
setDefaultReadPreference
public void setDefaultReadPreference(com.mongodb.ReadPreference defaultReadPreference) -
getCredentials
- Specified by:
getCredentialsin interfaceMorphiumDriver
-
isDefaultFsync
public boolean isDefaultFsync() -
setDefaultFsync
public void setDefaultFsync(boolean j) -
getHostSeed
- Specified by:
getHostSeedin interfaceMorphiumDriver
-
getName
- Specified by:
getNamein interfaceMorphiumDriver
-
setMaxBsonObjectSize
public void setMaxBsonObjectSize(int maxBsonObjectSize) - Specified by:
setMaxBsonObjectSizein interfaceMorphiumDriver
-
getMaxMessageSize
public int getMaxMessageSize()- Specified by:
getMaxMessageSizein interfaceMorphiumDriver
-
setMaxMessageSize
public void setMaxMessageSize(int maxMessageSize) - Specified by:
setMaxMessageSizein interfaceMorphiumDriver
-
getMaxWriteBatchSize
public int getMaxWriteBatchSize()- Specified by:
getMaxWriteBatchSizein interfaceMorphiumDriver
-
setMaxWriteBatchSize
public void setMaxWriteBatchSize(int maxWriteBatchSize) - Specified by:
setMaxWriteBatchSizein interfaceMorphiumDriver
-
isReplicaSet
public boolean isReplicaSet()- Specified by:
isReplicaSetin interfaceMorphiumDriver
-
setReplicaSet
public void setReplicaSet(boolean replicaSet) - Specified by:
setReplicaSetin interfaceMorphiumDriver
-
getDefaultJ
public boolean getDefaultJ()- Specified by:
getDefaultJin interfaceMorphiumDriver
-
getDefaultReadPreference
- Specified by:
getDefaultReadPreferencein interfaceMorphiumDriver
-
getBuildNumber
public int getBuildNumber() -
getMajorVersion
public int getMajorVersion() -
getMinorVersion
public int getMinorVersion() -
setDatabaseName
public void setDatabaseName() -
getDatabaseName
-
setHostSeed
- Specified by:
setHostSeedin interfaceMorphiumDriver
-
setHostSeed
- Specified by:
setHostSeedin interfaceMorphiumDriver
-
setConnectionUrl
- Specified by:
setConnectionUrlin interfaceMorphiumDriver
-
getMaxConnections
public int getMaxConnections()- Specified by:
getMaxConnectionsin interfaceMorphiumDriver
-
setMaxConnections
- Specified by:
setMaxConnectionsin interfaceMorphiumDriver
-
getMinConnections
public int getMinConnections()- Specified by:
getMinConnectionsin interfaceMorphiumDriver
-
setMinConnections
- Specified by:
setMinConnectionsin interfaceMorphiumDriver
-
getMaxConnectionLifetime
public int getMaxConnectionLifetime()- Specified by:
getMaxConnectionLifetimein interfaceMorphiumDriver
-
setMaxConnectionLifetime
public void setMaxConnectionLifetime(int timeout) - Specified by:
setMaxConnectionLifetimein interfaceMorphiumDriver
-
getMaxConnectionIdleTime
public int getMaxConnectionIdleTime()- Specified by:
getMaxConnectionIdleTimein interfaceMorphiumDriver
-
setMaxConnectionIdleTime
public void setMaxConnectionIdleTime(int time) - Specified by:
setMaxConnectionIdleTimein interfaceMorphiumDriver
-
getConnectionTimeout
public int getConnectionTimeout()- Specified by:
getConnectionTimeoutin interfaceMorphiumDriver
-
setConnectionTimeout
public void setConnectionTimeout(int timeout) - Specified by:
setConnectionTimeoutin interfaceMorphiumDriver
-
getDefaultW
public int getDefaultW()- Specified by:
getDefaultWin interfaceMorphiumDriver
-
setDefaultW
public void setDefaultW(int w) - Specified by:
setDefaultWin interfaceMorphiumDriver
-
getHeartbeatFrequency
public int getHeartbeatFrequency()- Specified by:
getHeartbeatFrequencyin interfaceMorphiumDriver
-
setHeartbeatFrequency
public void setHeartbeatFrequency(int heartbeatFrequency) - Specified by:
setHeartbeatFrequencyin interfaceMorphiumDriver
-
setDefaultReadPreference
- Specified by:
setDefaultReadPreferencein interfaceMorphiumDriver
-
setDefaultBatchSize
public void setDefaultBatchSize(int defaultBatchSize) - Specified by:
setDefaultBatchSizein interfaceMorphiumDriver
-
setCredentials
-
setMongo
public void setMongo(com.mongodb.client.MongoClient mongo) -
isRetryReads
public boolean isRetryReads()- Specified by:
isRetryReadsin interfaceMorphiumDriver
-
setRetryReads
- Specified by:
setRetryReadsin interfaceMorphiumDriver
-
isRetryWrites
public boolean isRetryWrites()- Specified by:
isRetryWritesin interfaceMorphiumDriver
-
setRetryWrites
- Specified by:
setRetryWritesin interfaceMorphiumDriver
-
getUuidRepresentation
-
setUuidRepresentation
-
isUseSSL
public boolean isUseSSL()- Specified by:
isUseSSLin interfaceMorphiumDriver
-
setUseSSL
public void setUseSSL(boolean useSSL) - Specified by:
setUseSSLin interfaceMorphiumDriver
-
isDefaultJ
public boolean isDefaultJ()- Specified by:
isDefaultJin interfaceMorphiumDriver
-
setDefaultJ
public void setDefaultJ(boolean j) - Specified by:
setDefaultJin interfaceMorphiumDriver
-
releaseConnection
- Specified by:
releaseConnectionin interfaceMorphiumDriver
-
getLocalThreshold
public int getLocalThreshold() -
setLocalThreshold
public void setLocalThreshold(int thr) -
heartBeatFrequency
public void heartBeatFrequency(int t) -
useSsl
public void useSsl(boolean ssl) -
getReadTimeout
public int getReadTimeout()- Specified by:
getReadTimeoutin interfaceMorphiumDriver
-
setReadTimeout
public void setReadTimeout(int readTimeout) - Specified by:
setReadTimeoutin interfaceMorphiumDriver
-
getMinConnectionsPerHost
public int getMinConnectionsPerHost()- Specified by:
getMinConnectionsPerHostin interfaceMorphiumDriver
-
setMinConnectionsPerHost
public void setMinConnectionsPerHost(int minConnectionsPerHost) - Specified by:
setMinConnectionsPerHostin interfaceMorphiumDriver
-
getMaxConnectionsPerHost
public int getMaxConnectionsPerHost()- Specified by:
getMaxConnectionsPerHostin interfaceMorphiumDriver
-
setMaxConnectionsPerHost
public void setMaxConnectionsPerHost(int maxConnectionsPerHost) - Specified by:
setMaxConnectionsPerHostin interfaceMorphiumDriver
-
connect
- Specified by:
connectin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
connect
- Specified by:
connectin interfaceMorphiumDriver
-
getMaximums
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceMorphiumDriver
-
getDefaultWriteTimeout
public int getDefaultWriteTimeout()- Specified by:
getDefaultWriteTimeoutin interfaceMorphiumDriver
-
setDefaultWriteTimeout
public void setDefaultWriteTimeout(int wt) - Specified by:
setDefaultWriteTimeoutin interfaceMorphiumDriver
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getReplsetStatus
- Specified by:
getReplsetStatusin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
getDBStats
- Specified by:
getDBStatsin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
getCollStats
- Specified by:
getCollStatsin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
getOps
-
runCommand
- Throws:
MorphiumDriverException
-
initAggregationIteration
public MorphiumCursor initAggregationIteration(String db, String collection, List<Map<String, Object>> aggregationPipeline, com.mongodb.ReadPreference readPreference, Collation collation, int batchSize, Doc findMetaData) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
initIteration
public MorphiumCursor initIteration(String db, String collection, Doc query, Map<String, Integer> sort, Doc projection, int skip, int limit, int batchSize, com.mongodb.ReadPreference readPreference, Collation collation, Doc findMetaData) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
watch
public void watch(String db, int maxWaitTime, boolean fullDocumentOnUpdate, List<Map<String, Object>> pipeline, DriverTailableIterationCallback cb) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
watch
public void watch(String db, String collection, int maxWaitTime, boolean fullDocumentOnUpdate, List<Map<String, Object>> pipeline, DriverTailableIterationCallback cb) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
tailableIteration
public void tailableIteration(String db, String collection, Doc query, Map<String, Integer> sort, Doc projection, int skip, int limit, int batchSize, com.mongodb.ReadPreference readPreference, int timeout, DriverTailableIterationCallback cb) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
nextIteration
- Throws:
MorphiumDriverException
-
closeIteration
- Throws:
MorphiumDriverException
-
find
public List<Map<String,Object>> find(String db, String collection, Doc query, Map<String, Integer> sort, Doc projection, int skip, int limit, int batchSize, com.mongodb.ReadPreference readPreference, Collation collation, Doc findMetaData) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
getCollection
public com.mongodb.client.MongoCollection<org.bson.Document> getCollection(com.mongodb.client.MongoDatabase database, String collection, com.mongodb.ReadPreference readPreference, WriteConcern wc) -
count
-
estimatedDocumentCount
-
store
public Map<String,Integer> store(String db, String collection, List<Map<String, Object>> objs, WriteConcern wc) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
insert
public void insert(String db, String collection, List<Map<String, Object>> objs, WriteConcern wc) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
update
public Doc update(String db, String collection, Doc query, Map<String, Integer> sort, Doc op, boolean multiple, boolean upsert, Collation collation, WriteConcern wc) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
delete
public Doc delete(String db, String collection, Doc query, Map<String, Integer> sort, boolean multiple, Collation collation, WriteConcern wc) throws MorphiumDriverException- Throws:
MorphiumDriverException
-
drop
- Throws:
MorphiumDriverException
-
drop
- Throws:
MorphiumDriverException
-
exists
- Specified by:
existsin interfaceMorphiumDriver
-
distinct
public List<Object> distinct(String db, String collection, String field, Doc filter, Collation collation, com.mongodb.ReadPreference rp) throws MorphiumDriverException - Throws:
MorphiumDriverException
-
exists
- Specified by:
existsin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
getIndexes
public List<Map<String,Object>> getIndexes(String db, String collection) throws MorphiumDriverException - Throws:
MorphiumDriverException
-
getCollectionNames
- Throws:
MorphiumDriverException
-
findAndOneAndDelete
-
findAndOneAndUpdate
-
findAndOneAndReplace
-
aggregate
-
getMaxWaitTime
public int getMaxWaitTime()- Specified by:
getMaxWaitTimein interfaceMorphiumDriver
-
setMaxWaitTime
public void setMaxWaitTime(int maxWaitTime) - Specified by:
setMaxWaitTimein interfaceMorphiumDriver
-
getServerSelectionTimeout
public int getServerSelectionTimeout() -
setServerSelectionTimeout
public void setServerSelectionTimeout(int serverSelectionTimeout) -
getRetriesOnNetworkError
public int getRetriesOnNetworkError()- Specified by:
getRetriesOnNetworkErrorin interfaceMorphiumDriver
-
setRetriesOnNetworkError
- Specified by:
setRetriesOnNetworkErrorin interfaceMorphiumDriver
-
getSleepBetweenErrorRetries
public int getSleepBetweenErrorRetries()- Specified by:
getSleepBetweenErrorRetriesin interfaceMorphiumDriver
-
setSleepBetweenErrorRetries
- Specified by:
setSleepBetweenErrorRetriesin interfaceMorphiumDriver
-
getCollectionStats
public Doc getCollectionStats(String db, String coll, int scale, boolean verbose) throws MorphiumDriverException - Throws:
MorphiumDriverException
-
isCapped
- Specified by:
isCappedin interfaceMorphiumDriver- Throws:
MorphiumDriverException
-
getNumConnectionsByHost
- Specified by:
getNumConnectionsByHostin interfaceMorphiumDriver
-
createBulkContext
public BulkRequestContext createBulkContext(Morphium m, String db, String collection, boolean ordered, WriteConcern wc) - Specified by:
createBulkContextin interfaceMorphiumDriver
-
getDriverStats
- Specified by:
getDriverStatsin interfaceMorphiumDriver
-
getDb
-
getCollection
-
createIndex
public void createIndex(String db, String collection, Doc index, Doc options) throws MorphiumDriverException - Throws:
MorphiumDriverException
-
mapReduce
-
mapReduce
-
mapReduce
-
startTransaction
public void startTransaction() -
commitTransaction
public void commitTransaction()- Specified by:
commitTransactionin interfaceMorphiumDriver
-
getTransactionContext
- Specified by:
getTransactionContextin interfaceMorphiumDriver
-
setTransactionContext
- Specified by:
setTransactionContextin interfaceMorphiumDriver
-
abortTransaction
public void abortTransaction()- Specified by:
abortTransactionin interfaceMorphiumDriver
-
getSslContext
-
setSslContext
-
isSslInvalidHostNameAllowed
public boolean isSslInvalidHostNameAllowed() -
setSslInvalidHostNameAllowed
public void setSslInvalidHostNameAllowed(boolean sslInvalidHostNameAllowed) -
getReadConnection
- Specified by:
getReadConnectionin interfaceMorphiumDriver
-
getPrimaryConnection
- Specified by:
getPrimaryConnectionin interfaceMorphiumDriver
-