public interface MongoDbDataSource extends DataSource
Modifier and Type | Method and Description |
---|---|
void |
createCollection(String databaseName,
String collectionName,
CreateCollectionOptions createOptions)
Creates a new collection or view.
|
void |
dropCollection(String databaseName,
String collectionName)
Removes a collection or view from the database.
|
void |
dropDatabase(String databaseName)
Removes the database, deleting the associated data files.
|
MongoClient |
getClient() |
MongoDbDatabase |
getConfig() |
void |
getSampleDocument(String databaseName,
String collectionName,
int sampleSize,
OutputStream outputStream)
Randomly select a specified number of documents from a collection.
|
MongoDbQueryResults |
query(String databaseName,
String collectionName,
io.toro.common.data.Pageable pageable,
QueryConfiguration queryConfiguration)
Execute a query against a MongoDB instance.
|
getDatabaseConnection, getJNDIObject, getStatus
MongoDbDatabase getConfig()
getConfig
in interface DataSource
MongoClient getClient()
MongoDbQueryResults query(String databaseName, String collectionName, io.toro.common.data.Pageable pageable, QueryConfiguration queryConfiguration)
databaseName
- the name of the MongoDB database where the collection to query belongscollectionName
- the name of the MongoDB collection to querypageable
- pagination settingsqueryConfiguration
- the query to executevoid getSampleDocument(String databaseName, String collectionName, int sampleSize, OutputStream outputStream) throws IOException
databaseName
- the name of the MongoDB database where the collection belongscollectionName
- the name of the MongoDB collection where documents will be retrieved fromsampleSize
- the number of random documents to obtainoutputStream
- where found documents will be written toIOException
- if an I/O error occurs while writing to the OutputStream
void dropDatabase(String databaseName)
databaseName
- the name of the database to removevoid createCollection(String databaseName, String collectionName, CreateCollectionOptions createOptions)
databaseName
- the name of the database to associate the collection fromcollectionName
- the name of the collectioncreateOptions
- the options to create the collectionvoid dropCollection(String databaseName, String collectionName)
databaseName
- the name of the database that has the collectioncollectionName
- the name of the collection to removeCopyright © 2020. All rights reserved.