@ThreadSafe
public interface MongoDatabase
Note: Additions to this interface will not be considered to break binary compatibility.
Modifier and Type | Method and Description |
---|---|
rx.Observable<Success> |
createCollection(String collectionName)
Create a new collection with the given name.
|
rx.Observable<Success> |
createCollection(String collectionName,
com.mongodb.client.model.CreateCollectionOptions options)
Create a new collection with the selected options
|
rx.Observable<Success> |
createView(String viewName,
String viewOn,
List<? extends org.bson.conversions.Bson> pipeline)
Creates a view with the given name, backing collection/view name, and aggregation pipeline that defines the view.
|
rx.Observable<Success> |
createView(String viewName,
String viewOn,
List<? extends org.bson.conversions.Bson> pipeline,
com.mongodb.client.model.CreateViewOptions createViewOptions)
Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.
|
rx.Observable<Success> |
drop()
Drops this database.
|
org.bson.codecs.configuration.CodecRegistry |
getCodecRegistry()
Get the codec registry for the MongoDatabase.
|
MongoCollection<org.bson.Document> |
getCollection(String collectionName)
Gets a collection.
|
<TDocument> |
getCollection(String collectionName,
Class<TDocument> clazz)
Gets a collection, with a specific default document class.
|
String |
getName()
Gets the name of the database.
|
ObservableAdapter |
getObservableAdapter()
Get the ObservableAdapter for the MongoDatabase.
|
com.mongodb.ReadConcern |
getReadConcern()
Get the read concern for the MongoDatabase.
|
com.mongodb.ReadPreference |
getReadPreference()
Get the read preference for the MongoDatabase.
|
com.mongodb.WriteConcern |
getWriteConcern()
Get the write concern for the MongoDatabase.
|
rx.Observable<String> |
listCollectionNames()
Gets the names of all the collections in this database.
|
ListCollectionsObservable<org.bson.Document> |
listCollections()
Finds all the collections in this database.
|
<TResult> ListCollectionsObservable<TResult> |
listCollections(Class<TResult> clazz)
Finds all the collections in this database.
|
rx.Observable<org.bson.Document> |
runCommand(org.bson.conversions.Bson command)
Executes command in the context of the current database.
|
<TResult> rx.Observable<TResult> |
runCommand(org.bson.conversions.Bson command,
Class<TResult> clazz)
Executes command in the context of the current database.
|
rx.Observable<org.bson.Document> |
runCommand(org.bson.conversions.Bson command,
com.mongodb.ReadPreference readPreference)
Executes command in the context of the current database.
|
<TResult> rx.Observable<TResult> |
runCommand(org.bson.conversions.Bson command,
com.mongodb.ReadPreference readPreference,
Class<TResult> clazz)
Executes command in the context of the current database.
|
MongoDatabase |
withCodecRegistry(org.bson.codecs.configuration.CodecRegistry codecRegistry)
Create a new MongoDatabase instance with a different codec registry.
|
MongoDatabase |
withObservableAdapter(ObservableAdapter observableAdapter)
Create a new MongoDatabase instance with a different
ObservableAdapter . |
MongoDatabase |
withReadConcern(com.mongodb.ReadConcern readConcern)
Create a new MongoDatabase instance with a different read concern.
|
MongoDatabase |
withReadPreference(com.mongodb.ReadPreference readPreference)
Create a new MongoDatabase instance with a different read preference.
|
MongoDatabase |
withWriteConcern(com.mongodb.WriteConcern writeConcern)
Create a new MongoDatabase instance with a different write concern.
|
String getName()
ObservableAdapter getObservableAdapter()
ObservableAdapter
org.bson.codecs.configuration.CodecRegistry getCodecRegistry()
CodecRegistry
com.mongodb.ReadPreference getReadPreference()
ReadPreference
com.mongodb.WriteConcern getWriteConcern()
WriteConcern
com.mongodb.ReadConcern getReadConcern()
ReadConcern
MongoDatabase withObservableAdapter(ObservableAdapter observableAdapter)
ObservableAdapter
.observableAdapter
- the new ObservableAdapter
for the databaseMongoDatabase withCodecRegistry(org.bson.codecs.configuration.CodecRegistry codecRegistry)
codecRegistry
- the new CodecRegistry
for the databaseMongoDatabase withReadPreference(com.mongodb.ReadPreference readPreference)
readPreference
- the new ReadPreference
for the databaseMongoDatabase withWriteConcern(com.mongodb.WriteConcern writeConcern)
writeConcern
- the new WriteConcern
for the databaseMongoDatabase withReadConcern(com.mongodb.ReadConcern readConcern)
readConcern
- the new ReadConcern
for the databaseMongoCollection<org.bson.Document> getCollection(String collectionName)
collectionName
- the name of the collection to return<TDocument> MongoCollection<TDocument> getCollection(String collectionName, Class<TDocument> clazz)
TDocument
- the type of the class to use instead of Document
.collectionName
- the name of the collection to returnclazz
- the default class to cast any documents returned from the database into.rx.Observable<org.bson.Document> runCommand(org.bson.conversions.Bson command)
command
- the command to be runrx.Observable<org.bson.Document> runCommand(org.bson.conversions.Bson command, com.mongodb.ReadPreference readPreference)
command
- the command to be runreadPreference
- the ReadPreference
to be used when executing the command<TResult> rx.Observable<TResult> runCommand(org.bson.conversions.Bson command, Class<TResult> clazz)
TResult
- the type of the class to use instead of Document
.command
- the command to be runclazz
- the default class to cast any documents returned from the database into.<TResult> rx.Observable<TResult> runCommand(org.bson.conversions.Bson command, com.mongodb.ReadPreference readPreference, Class<TResult> clazz)
TResult
- the type of the class to use instead of Document
.command
- the command to be runreadPreference
- the ReadPreference
to be used when executing the commandclazz
- the default class to cast any documents returned from the database into.rx.Observable<Success> drop()
rx.Observable<String> listCollectionNames()
ListCollectionsObservable<org.bson.Document> listCollections()
<TResult> ListCollectionsObservable<TResult> listCollections(Class<TResult> clazz)
TResult
- the target document type of the iterable.clazz
- the class to decode each document intorx.Observable<Success> createCollection(String collectionName)
collectionName
- the name for the new collection to createrx.Observable<Success> createCollection(String collectionName, com.mongodb.client.model.CreateCollectionOptions options)
collectionName
- the name for the new collection to createoptions
- various options for creating the collectionrx.Observable<Success> createView(String viewName, String viewOn, List<? extends org.bson.conversions.Bson> pipeline)
viewName
- the name of the view to createviewOn
- the backing collection/view for the viewpipeline
- the pipeline that defines the viewrx.Observable<Success> createView(String viewName, String viewOn, List<? extends org.bson.conversions.Bson> pipeline, com.mongodb.client.model.CreateViewOptions createViewOptions)
viewName
- the name of the view to createviewOn
- the backing collection/view for the viewpipeline
- the pipeline that defines the viewcreateViewOptions
- various options for creating the view