Class MongoClient
- java.lang.Object
-
- io.vertx.rxjava3.ext.mongo.MongoClient
-
-
Field Summary
Fields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<MongoClient>
__TYPE_ARG
static String
DEFAULT_DB_NAME
The name of the default databasestatic String
DEFAULT_POOL_NAME
The name of the default pool
-
Constructor Summary
Constructors Constructor Description MongoClient(MongoClient delegate)
MongoClient(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReadStream<JsonObject>
aggregate(String collection, JsonArray pipeline)
Run aggregate MongoDB command with defaultAggregateOptions
.ReadStream<JsonObject>
aggregateWithOptions(String collection, JsonArray pipeline, AggregateOptions options)
Run aggregate MongoDB command.Maybe<MongoClientBulkWriteResult>
bulkWrite(String collection, List<BulkOperation> operations)
Execute a bulk operation.Maybe<MongoClientBulkWriteResult>
bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions)
Execute a bulk operation with the specified write options.Completable
close()
Close the client and release its resourcesSingle<Long>
count(String collection, JsonObject query)
Count matching documents in a collection.Single<Long>
countWithOptions(String collection, JsonObject query, CountOptions countOptions)
Count matching documents in a collection.static MongoClient
create(Vertx vertx, JsonObject config)
Create a Mongo client which maintains its own data source.Completable
createCollection(String collectionName)
Create a new collectionCompletable
createCollectionWithOptions(String collectionName, CreateCollectionOptions collectionOptions)
Create a new collection with optionsSingle<MongoGridFsClient>
createDefaultGridFsBucketService()
Creates aMongoGridFsClient
used to interact with Mongo GridFS.Single<MongoGridFsClient>
createGridFsBucketService(String bucketName)
Creates aMongoGridFsClient
used to interact with Mongo GridFS.Completable
createIndex(String collection, JsonObject key)
Creates an index.Completable
createIndexes(String collection, List<IndexModel> indexes)
creates an indexesCompletable
createIndexWithOptions(String collection, JsonObject key, IndexOptions options)
Creates an index.static MongoClient
createShared(Vertx vertx, JsonObject config)
LikecreateShared(io.vertx.rxjava3.core.Vertx, io.vertx.core.json.JsonObject, java.lang.String)
but with the default data source namestatic MongoClient
createShared(Vertx vertx, JsonObject config, String dataSourceName)
Create a Mongo client which shares its data source with any other Mongo clients created with the same data source nameSingle<JsonArray>
distinct(String collection, String fieldName, String resultClassname)
Gets the distinct values of the specified field name.Single<JsonArray>
distinct(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name.ReadStream<JsonObject>
distinctBatch(String collection, String fieldName, String resultClassname)
Gets the distinct values of the specified field name.ReadStream<JsonObject>
distinctBatch(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name.ReadStream<JsonObject>
distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
Gets the distinct values of the specified field name filtered by specified query.ReadStream<JsonObject>
distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize)
Gets the distinct values of the specified field name filtered by specified query.ReadStream<JsonObject>
distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query.ReadStream<JsonObject>
distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query.Single<JsonArray>
distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
Gets the distinct values of the specified field name filtered by specified query.Single<JsonArray>
distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query.Completable
dropCollection(String collection)
Drop a collectionCompletable
dropIndex(String collection, JsonObject key)
Drops the index given the keys used to create it.Completable
dropIndex(String collection, String indexName)
Drops the index given its name.boolean
equals(Object o)
Single<List<JsonObject>>
find(String collection, JsonObject query)
Find matching documents in the specified collectionReadStream<JsonObject>
findBatch(String collection, JsonObject query)
Find matching documents in the specified collection.ReadStream<JsonObject>
findBatchWithOptions(String collection, JsonObject query, FindOptions options)
Find matching documents in the specified collection, specifying options.Maybe<JsonObject>
findOne(String collection, JsonObject query, JsonObject fields)
Find a single matching document in the specified collectionMaybe<JsonObject>
findOneAndDelete(String collection, JsonObject query)
Find a single matching document in the specified collection and delete it.Maybe<JsonObject>
findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions)
Find a single matching document in the specified collection and delete it.Maybe<JsonObject>
findOneAndReplace(String collection, JsonObject query, JsonObject replace)
Find a single matching document in the specified collection and replace it.Maybe<JsonObject>
findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and replace it.Maybe<JsonObject>
findOneAndUpdate(String collection, JsonObject query, JsonObject update)
Find a single matching document in the specified collection and update it.Maybe<JsonObject>
findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and update it.Single<List<JsonObject>>
findWithOptions(String collection, JsonObject query, FindOptions options)
Find matching documents in the specified collection, specifying optionsSingle<List<String>>
getCollections()
Get a list of all collections in the database.MongoClient
getDelegate()
int
hashCode()
Maybe<String>
insert(String collection, JsonObject document)
Insert a document in the specified collectionMaybe<String>
insertWithOptions(String collection, JsonObject document, WriteOption writeOption)
Insert a document in the specified collection with the specified write optionSingle<JsonArray>
listIndexes(String collection)
Get all the indexes in this collection.static MongoClient
newInstance(MongoClient arg)
Maybe<MongoClientDeleteResult>
removeDocument(String collection, JsonObject query)
Remove a single matching document from a collection and return the handler withMongoClientDeleteResult
resultMaybe<MongoClientDeleteResult>
removeDocuments(String collection, JsonObject query)
Remove matching documents from a collection and return the handler withMongoClientDeleteResult
resultMaybe<MongoClientDeleteResult>
removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove matching documents from a collection with the specified write option and return the handler withMongoClientDeleteResult
resultMaybe<MongoClientDeleteResult>
removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove a single matching document from a collection with the specified write option and return the handler withMongoClientDeleteResult
resultCompletable
renameCollection(String oldCollectionName, String newCollectionName)
Rename a collectionCompletable
renameCollectionWithOptions(String oldCollectionName, String newCollectionName, RenameCollectionOptions collectionOptions)
Rename a collectionMaybe<MongoClientUpdateResult>
replaceDocuments(String collection, JsonObject query, JsonObject replace)
Replace matching documents in the specified collection and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options)
Replace matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
resultMaybe<JsonObject>
runCommand(String commandName, JsonObject command)
Run an arbitrary MongoDB command.Maybe<MongoClientBulkWriteResult>
rxBulkWrite(String collection, List<BulkOperation> operations)
Execute a bulk operation.Maybe<MongoClientBulkWriteResult>
rxBulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions)
Execute a bulk operation with the specified write options.Completable
rxClose()
Close the client and release its resourcesSingle<Long>
rxCount(String collection, JsonObject query)
Count matching documents in a collection.Single<Long>
rxCountWithOptions(String collection, JsonObject query, CountOptions countOptions)
Count matching documents in a collection.Completable
rxCreateCollection(String collectionName)
Create a new collectionCompletable
rxCreateCollectionWithOptions(String collectionName, CreateCollectionOptions collectionOptions)
Create a new collection with optionsSingle<MongoGridFsClient>
rxCreateDefaultGridFsBucketService()
Creates aMongoGridFsClient
used to interact with Mongo GridFS.Single<MongoGridFsClient>
rxCreateGridFsBucketService(String bucketName)
Creates aMongoGridFsClient
used to interact with Mongo GridFS.Completable
rxCreateIndex(String collection, JsonObject key)
Creates an index.Completable
rxCreateIndexes(String collection, List<IndexModel> indexes)
creates an indexesCompletable
rxCreateIndexWithOptions(String collection, JsonObject key, IndexOptions options)
Creates an index.Single<JsonArray>
rxDistinct(String collection, String fieldName, String resultClassname)
Gets the distinct values of the specified field name.Single<JsonArray>
rxDistinct(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name.Single<JsonArray>
rxDistinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
Gets the distinct values of the specified field name filtered by specified query.Single<JsonArray>
rxDistinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query.Completable
rxDropCollection(String collection)
Drop a collectionCompletable
rxDropIndex(String collection, JsonObject key)
Drops the index given the keys used to create it.Completable
rxDropIndex(String collection, String indexName)
Drops the index given its name.Single<List<JsonObject>>
rxFind(String collection, JsonObject query)
Find matching documents in the specified collectionMaybe<JsonObject>
rxFindOne(String collection, JsonObject query, JsonObject fields)
Find a single matching document in the specified collectionMaybe<JsonObject>
rxFindOneAndDelete(String collection, JsonObject query)
Find a single matching document in the specified collection and delete it.Maybe<JsonObject>
rxFindOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions)
Find a single matching document in the specified collection and delete it.Maybe<JsonObject>
rxFindOneAndReplace(String collection, JsonObject query, JsonObject replace)
Find a single matching document in the specified collection and replace it.Maybe<JsonObject>
rxFindOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and replace it.Maybe<JsonObject>
rxFindOneAndUpdate(String collection, JsonObject query, JsonObject update)
Find a single matching document in the specified collection and update it.Maybe<JsonObject>
rxFindOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and update it.Single<List<JsonObject>>
rxFindWithOptions(String collection, JsonObject query, FindOptions options)
Find matching documents in the specified collection, specifying optionsSingle<List<String>>
rxGetCollections()
Get a list of all collections in the database.Maybe<String>
rxInsert(String collection, JsonObject document)
Insert a document in the specified collectionMaybe<String>
rxInsertWithOptions(String collection, JsonObject document, WriteOption writeOption)
Insert a document in the specified collection with the specified write optionSingle<JsonArray>
rxListIndexes(String collection)
Get all the indexes in this collection.Maybe<MongoClientDeleteResult>
rxRemoveDocument(String collection, JsonObject query)
Remove a single matching document from a collection and return the handler withMongoClientDeleteResult
resultMaybe<MongoClientDeleteResult>
rxRemoveDocuments(String collection, JsonObject query)
Remove matching documents from a collection and return the handler withMongoClientDeleteResult
resultMaybe<MongoClientDeleteResult>
rxRemoveDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove matching documents from a collection with the specified write option and return the handler withMongoClientDeleteResult
resultMaybe<MongoClientDeleteResult>
rxRemoveDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove a single matching document from a collection with the specified write option and return the handler withMongoClientDeleteResult
resultCompletable
rxRenameCollection(String oldCollectionName, String newCollectionName)
Rename a collectionCompletable
rxRenameCollectionWithOptions(String oldCollectionName, String newCollectionName, RenameCollectionOptions collectionOptions)
Rename a collectionMaybe<MongoClientUpdateResult>
rxReplaceDocuments(String collection, JsonObject query, JsonObject replace)
Replace matching documents in the specified collection and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
rxReplaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options)
Replace matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
resultMaybe<JsonObject>
rxRunCommand(String commandName, JsonObject command)
Run an arbitrary MongoDB command.Maybe<String>
rxSave(String collection, JsonObject document)
Save a document in the specified collectionMaybe<String>
rxSaveWithOptions(String collection, JsonObject document, WriteOption writeOption)
Save a document in the specified collection with the specified write optionMaybe<MongoClientUpdateResult>
rxUpdateCollection(String collection, JsonObject query, JsonArray update)
Use an aggregation pipeline to update documents in the specified collection and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
rxUpdateCollection(String collection, JsonObject query, JsonObject update)
Update matching documents in the specified collection and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
rxUpdateCollectionWithOptions(String collection, JsonObject query, JsonArray update, UpdateOptions options)
Use an aggregation pipeline to update documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
rxUpdateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options)
Update matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
resultMaybe<String>
save(String collection, JsonObject document)
Save a document in the specified collectionMaybe<String>
saveWithOptions(String collection, JsonObject document, WriteOption writeOption)
Save a document in the specified collection with the specified write optionString
toString()
Maybe<MongoClientUpdateResult>
updateCollection(String collection, JsonObject query, JsonArray update)
Use an aggregation pipeline to update documents in the specified collection and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
updateCollection(String collection, JsonObject query, JsonObject update)
Update matching documents in the specified collection and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
updateCollectionWithOptions(String collection, JsonObject query, JsonArray update, UpdateOptions options)
Use an aggregation pipeline to update documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
resultMaybe<MongoClientUpdateResult>
updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options)
Update matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
resultReadStream<com.mongodb.client.model.changestream.ChangeStreamDocument<JsonObject>>
watch(String collection, JsonArray pipeline, boolean withUpdatedDoc, int batchSize)
Watch the collection change.
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<MongoClient> __TYPE_ARG
-
DEFAULT_POOL_NAME
public static final String DEFAULT_POOL_NAME
The name of the default pool- See Also:
- Constant Field Values
-
DEFAULT_DB_NAME
public static final String DEFAULT_DB_NAME
The name of the default database- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MongoClient
public MongoClient(MongoClient delegate)
-
MongoClient
public MongoClient(Object delegate)
-
-
Method Detail
-
getDelegate
public MongoClient getDelegate()
-
create
public static MongoClient create(Vertx vertx, JsonObject config)
Create a Mongo client which maintains its own data source.- Parameters:
vertx
- the Vert.x instanceconfig
- the configuration- Returns:
- the client
-
createShared
public static MongoClient createShared(Vertx vertx, JsonObject config, String dataSourceName)
Create a Mongo client which shares its data source with any other Mongo clients created with the same data source name- Parameters:
vertx
- the Vert.x instanceconfig
- the configurationdataSourceName
- the data source name- Returns:
- the client
-
createShared
public static MongoClient createShared(Vertx vertx, JsonObject config)
LikecreateShared(io.vertx.rxjava3.core.Vertx, io.vertx.core.json.JsonObject, java.lang.String)
but with the default data source name- Parameters:
vertx
- the Vert.x instanceconfig
- the configuration- Returns:
- the client
-
save
public Maybe<String> save(String collection, JsonObject document)
Save a document in the specified collectionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the document- Returns:
- a future provided with the id if document didn't already have one
-
rxSave
public Maybe<String> rxSave(String collection, JsonObject document)
Save a document in the specified collectionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the document- Returns:
- a future provided with the id if document didn't already have one
-
saveWithOptions
public Maybe<String> saveWithOptions(String collection, JsonObject document, WriteOption writeOption)
Save a document in the specified collection with the specified write optionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the documentwriteOption
- the write option to use- Returns:
- a future provided with the id if document didn't already have one
-
rxSaveWithOptions
public Maybe<String> rxSaveWithOptions(String collection, JsonObject document, WriteOption writeOption)
Save a document in the specified collection with the specified write optionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the documentwriteOption
- the write option to use- Returns:
- a future provided with the id if document didn't already have one
-
insert
public Maybe<String> insert(String collection, JsonObject document)
Insert a document in the specified collectionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the document- Returns:
- a future provided with the id if document didn't already have one
-
rxInsert
public Maybe<String> rxInsert(String collection, JsonObject document)
Insert a document in the specified collectionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the document- Returns:
- a future provided with the id if document didn't already have one
-
insertWithOptions
public Maybe<String> insertWithOptions(String collection, JsonObject document, WriteOption writeOption)
Insert a document in the specified collection with the specified write optionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the documentwriteOption
- the write option to use- Returns:
- a future provided with the id if document didn't already have one
-
rxInsertWithOptions
public Maybe<String> rxInsertWithOptions(String collection, JsonObject document, WriteOption writeOption)
Insert a document in the specified collection with the specified write optionThis operation might change _id field of document parameter
- Parameters:
collection
- the collectiondocument
- the documentwriteOption
- the write option to use- Returns:
- a future provided with the id if document didn't already have one
-
updateCollection
public Maybe<MongoClientUpdateResult> updateCollection(String collection, JsonObject query, JsonObject update)
Update matching documents in the specified collection and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updated- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
rxUpdateCollection
public Maybe<MongoClientUpdateResult> rxUpdateCollection(String collection, JsonObject query, JsonObject update)
Update matching documents in the specified collection and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updated- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
updateCollection
public Maybe<MongoClientUpdateResult> updateCollection(String collection, JsonObject query, JsonArray update)
Use an aggregation pipeline to update documents in the specified collection and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updated- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
rxUpdateCollection
public Maybe<MongoClientUpdateResult> rxUpdateCollection(String collection, JsonObject query, JsonArray update)
Use an aggregation pipeline to update documents in the specified collection and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updated- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
updateCollectionWithOptions
public Maybe<MongoClientUpdateResult> updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options)
Update matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updatedoptions
- options to configure the update- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
rxUpdateCollectionWithOptions
public Maybe<MongoClientUpdateResult> rxUpdateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options)
Update matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updatedoptions
- options to configure the update- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
updateCollectionWithOptions
public Maybe<MongoClientUpdateResult> updateCollectionWithOptions(String collection, JsonObject query, JsonArray update, UpdateOptions options)
Use an aggregation pipeline to update documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- aggregation pipeline used to describe how documents will be updatedoptions
- options to configure the update- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
rxUpdateCollectionWithOptions
public Maybe<MongoClientUpdateResult> rxUpdateCollectionWithOptions(String collection, JsonObject query, JsonArray update, UpdateOptions options)
Use an aggregation pipeline to update documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsupdate
- aggregation pipeline used to describe how documents will be updatedoptions
- options to configure the update- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
replaceDocuments
public Maybe<MongoClientUpdateResult> replaceDocuments(String collection, JsonObject query, JsonObject replace)
Replace matching documents in the specified collection and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsreplace
- all matching documents will be replaced with this- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
rxReplaceDocuments
public Maybe<MongoClientUpdateResult> rxReplaceDocuments(String collection, JsonObject query, JsonObject replace)
Replace matching documents in the specified collection and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsreplace
- all matching documents will be replaced with this- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
replaceDocumentsWithOptions
public Maybe<MongoClientUpdateResult> replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options)
Replace matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsreplace
- all matching documents will be replaced with thisoptions
- options to configure the replace- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
rxReplaceDocumentsWithOptions
public Maybe<MongoClientUpdateResult> rxReplaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options)
Replace matching documents in the specified collection, specifying options and return the handler withMongoClientUpdateResult
result- Parameters:
collection
- the collectionquery
- query used to match the documentsreplace
- all matching documents will be replaced with thisoptions
- options to configure the replace- Returns:
- a future notified with a
MongoClientUpdateResult
when complete
-
bulkWrite
public Maybe<MongoClientBulkWriteResult> bulkWrite(String collection, List<BulkOperation> operations)
Execute a bulk operation. Can insert, update, replace, and/or delete multiple documents with one request.- Parameters:
collection
- the collectionoperations
- the operations to execute- Returns:
- a future notified with a
MongoClientBulkWriteResult
when complete
-
rxBulkWrite
public Maybe<MongoClientBulkWriteResult> rxBulkWrite(String collection, List<BulkOperation> operations)
Execute a bulk operation. Can insert, update, replace, and/or delete multiple documents with one request.- Parameters:
collection
- the collectionoperations
- the operations to execute- Returns:
- a future notified with a
MongoClientBulkWriteResult
when complete
-
bulkWriteWithOptions
public Maybe<MongoClientBulkWriteResult> bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions)
Execute a bulk operation with the specified write options. Can insert, update, replace, and/or delete multiple documents with one request.- Parameters:
collection
- the collectionoperations
- the operations to executebulkWriteOptions
- the write options- Returns:
- a future notified with a
MongoClientBulkWriteResult
when complete
-
rxBulkWriteWithOptions
public Maybe<MongoClientBulkWriteResult> rxBulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions)
Execute a bulk operation with the specified write options. Can insert, update, replace, and/or delete multiple documents with one request.- Parameters:
collection
- the collectionoperations
- the operations to executebulkWriteOptions
- the write options- Returns:
- a future notified with a
MongoClientBulkWriteResult
when complete
-
find
public Single<List<JsonObject>> find(String collection, JsonObject query)
Find matching documents in the specified collection- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a future provided with list of documents
-
rxFind
public Single<List<JsonObject>> rxFind(String collection, JsonObject query)
Find matching documents in the specified collection- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a future provided with list of documents
-
findBatch
public ReadStream<JsonObject> findBatch(String collection, JsonObject query)
Find matching documents in the specified collection. This method use batchCursor for returning each found document.- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a emitting found documents
-
findWithOptions
public Single<List<JsonObject>> findWithOptions(String collection, JsonObject query, FindOptions options)
Find matching documents in the specified collection, specifying options- Parameters:
collection
- the collectionquery
- query used to match documentsoptions
- options to configure the find- Returns:
- a future provided with list of documents
-
rxFindWithOptions
public Single<List<JsonObject>> rxFindWithOptions(String collection, JsonObject query, FindOptions options)
Find matching documents in the specified collection, specifying options- Parameters:
collection
- the collectionquery
- query used to match documentsoptions
- options to configure the find- Returns:
- a future provided with list of documents
-
findBatchWithOptions
public ReadStream<JsonObject> findBatchWithOptions(String collection, JsonObject query, FindOptions options)
Find matching documents in the specified collection, specifying options. This method use batchCursor for returning each found document.- Parameters:
collection
- the collectionquery
- query used to match documentsoptions
- options to configure the find- Returns:
- a emitting found documents
-
findOne
public Maybe<JsonObject> findOne(String collection, JsonObject query, JsonObject fields)
Find a single matching document in the specified collectionThis operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentfields
- the fields- Returns:
- a future provided with the document, if any
-
rxFindOne
public Maybe<JsonObject> rxFindOne(String collection, JsonObject query, JsonObject fields)
Find a single matching document in the specified collectionThis operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentfields
- the fields- Returns:
- a future provided with the document, if any
-
findOneAndUpdate
public Maybe<JsonObject> findOneAndUpdate(String collection, JsonObject query, JsonObject update)
Find a single matching document in the specified collection and update it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentupdate
- used to describe how the documents will be updated- Returns:
- a future provided with the document, if any
-
rxFindOneAndUpdate
public Maybe<JsonObject> rxFindOneAndUpdate(String collection, JsonObject query, JsonObject update)
Find a single matching document in the specified collection and update it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentupdate
- used to describe how the documents will be updated- Returns:
- a future provided with the document, if any
-
findOneAndUpdateWithOptions
public Maybe<JsonObject> findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and update it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentupdate
- used to describe how the documents will be updatedfindOptions
- options to configure the findupdateOptions
- options to configure the update- Returns:
- a future provided with the document, if any
-
rxFindOneAndUpdateWithOptions
public Maybe<JsonObject> rxFindOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and update it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentupdate
- used to describe how the documents will be updatedfindOptions
- options to configure the findupdateOptions
- options to configure the update- Returns:
- a future provided with the document, if any
-
findOneAndReplace
public Maybe<JsonObject> findOneAndReplace(String collection, JsonObject query, JsonObject replace)
Find a single matching document in the specified collection and replace it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentreplace
- the replacement document- Returns:
- a future provided with the document, if any
-
rxFindOneAndReplace
public Maybe<JsonObject> rxFindOneAndReplace(String collection, JsonObject query, JsonObject replace)
Find a single matching document in the specified collection and replace it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentreplace
- the replacement document- Returns:
- a future provided with the document, if any
-
findOneAndReplaceWithOptions
public Maybe<JsonObject> findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and replace it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentreplace
- the replacement documentfindOptions
- options to configure the findupdateOptions
- options to configure the update- Returns:
- a future provided with the document, if any
-
rxFindOneAndReplaceWithOptions
public Maybe<JsonObject> rxFindOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions)
Find a single matching document in the specified collection and replace it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentreplace
- the replacement documentfindOptions
- options to configure the findupdateOptions
- options to configure the update- Returns:
- a future provided with the document, if any
-
findOneAndDelete
public Maybe<JsonObject> findOneAndDelete(String collection, JsonObject query)
Find a single matching document in the specified collection and delete it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the document- Returns:
- a future provided with the deleted document, if any
-
rxFindOneAndDelete
public Maybe<JsonObject> rxFindOneAndDelete(String collection, JsonObject query)
Find a single matching document in the specified collection and delete it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the document- Returns:
- a future provided with the deleted document, if any
-
findOneAndDeleteWithOptions
public Maybe<JsonObject> findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions)
Find a single matching document in the specified collection and delete it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentfindOptions
- options to configure the find- Returns:
- a future provided with the deleted document, if any
-
rxFindOneAndDeleteWithOptions
public Maybe<JsonObject> rxFindOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions)
Find a single matching document in the specified collection and delete it.This operation might change _id field of query parameter
- Parameters:
collection
- the collectionquery
- the query used to match the documentfindOptions
- options to configure the find- Returns:
- a future provided with the deleted document, if any
-
count
public Single<Long> count(String collection, JsonObject query)
Count matching documents in a collection.- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a future provided with the number of matching documents
-
rxCount
public Single<Long> rxCount(String collection, JsonObject query)
Count matching documents in a collection.- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a future provided with the number of matching documents
-
countWithOptions
public Single<Long> countWithOptions(String collection, JsonObject query, CountOptions countOptions)
Count matching documents in a collection.- Parameters:
collection
- the collectionquery
- query used to match documentscountOptions
-- Returns:
- a future provided with the number of matching documents
-
rxCountWithOptions
public Single<Long> rxCountWithOptions(String collection, JsonObject query, CountOptions countOptions)
Count matching documents in a collection.- Parameters:
collection
- the collectionquery
- query used to match documentscountOptions
-- Returns:
- a future provided with the number of matching documents
-
removeDocuments
public Maybe<MongoClientDeleteResult> removeDocuments(String collection, JsonObject query)
Remove matching documents from a collection and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
rxRemoveDocuments
public Maybe<MongoClientDeleteResult> rxRemoveDocuments(String collection, JsonObject query)
Remove matching documents from a collection and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match documents- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
removeDocumentsWithOptions
public Maybe<MongoClientDeleteResult> removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove matching documents from a collection with the specified write option and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match documentswriteOption
- the write option to use- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
rxRemoveDocumentsWithOptions
public Maybe<MongoClientDeleteResult> rxRemoveDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove matching documents from a collection with the specified write option and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match documentswriteOption
- the write option to use- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
removeDocument
public Maybe<MongoClientDeleteResult> removeDocument(String collection, JsonObject query)
Remove a single matching document from a collection and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match document- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
rxRemoveDocument
public Maybe<MongoClientDeleteResult> rxRemoveDocument(String collection, JsonObject query)
Remove a single matching document from a collection and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match document- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
removeDocumentWithOptions
public Maybe<MongoClientDeleteResult> removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove a single matching document from a collection with the specified write option and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match documentwriteOption
- the write option to use- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
rxRemoveDocumentWithOptions
public Maybe<MongoClientDeleteResult> rxRemoveDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption)
Remove a single matching document from a collection with the specified write option and return the handler withMongoClientDeleteResult
result- Parameters:
collection
- the collectionquery
- query used to match documentwriteOption
- the write option to use- Returns:
- a future notified with a
MongoClientDeleteResult
when complete
-
createCollection
public Completable createCollection(String collectionName)
Create a new collection- Parameters:
collectionName
- the name of the collection- Returns:
- a future notified once complete
-
rxCreateCollection
public Completable rxCreateCollection(String collectionName)
Create a new collection- Parameters:
collectionName
- the name of the collection- Returns:
- a future notified once complete
-
createCollectionWithOptions
public Completable createCollectionWithOptions(String collectionName, CreateCollectionOptions collectionOptions)
Create a new collection with options- Parameters:
collectionName
- the name of the collectioncollectionOptions
- options of the collection- Returns:
- a future notified once complete
-
rxCreateCollectionWithOptions
public Completable rxCreateCollectionWithOptions(String collectionName, CreateCollectionOptions collectionOptions)
Create a new collection with options- Parameters:
collectionName
- the name of the collectioncollectionOptions
- options of the collection- Returns:
- a future notified once complete
-
getCollections
public Single<List<String>> getCollections()
Get a list of all collections in the database.- Returns:
- a future notified with a list of collections.
-
rxGetCollections
public Single<List<String>> rxGetCollections()
Get a list of all collections in the database.- Returns:
- a future notified with a list of collections.
-
dropCollection
public Completable dropCollection(String collection)
Drop a collection- Parameters:
collection
- the collection- Returns:
- a future notified when complete
-
rxDropCollection
public Completable rxDropCollection(String collection)
Drop a collection- Parameters:
collection
- the collection- Returns:
- a future notified when complete
-
renameCollection
public Completable renameCollection(String oldCollectionName, String newCollectionName)
Rename a collection- Parameters:
oldCollectionName
- the name of the collectionnewCollectionName
- the new name of the collection- Returns:
- a future notified when complete
-
rxRenameCollection
public Completable rxRenameCollection(String oldCollectionName, String newCollectionName)
Rename a collection- Parameters:
oldCollectionName
- the name of the collectionnewCollectionName
- the new name of the collection- Returns:
- a future notified when complete
-
renameCollectionWithOptions
public Completable renameCollectionWithOptions(String oldCollectionName, String newCollectionName, RenameCollectionOptions collectionOptions)
Rename a collection- Parameters:
oldCollectionName
- the name of the collectionnewCollectionName
- the new name of the collectioncollectionOptions
- options of the collection- Returns:
- a future notified when complete
-
rxRenameCollectionWithOptions
public Completable rxRenameCollectionWithOptions(String oldCollectionName, String newCollectionName, RenameCollectionOptions collectionOptions)
Rename a collection- Parameters:
oldCollectionName
- the name of the collectionnewCollectionName
- the new name of the collectioncollectionOptions
- options of the collection- Returns:
- a future notified when complete
-
createIndex
public Completable createIndex(String collection, JsonObject key)
Creates an index.- Parameters:
collection
- the collectionkey
- A document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.- Returns:
- a future notified when complete
-
rxCreateIndex
public Completable rxCreateIndex(String collection, JsonObject key)
Creates an index.- Parameters:
collection
- the collectionkey
- A document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.- Returns:
- a future notified when complete
-
createIndexWithOptions
public Completable createIndexWithOptions(String collection, JsonObject key, IndexOptions options)
Creates an index.- Parameters:
collection
- the collectionkey
- A document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.options
- the options for the index- Returns:
- a future notified when complete
-
rxCreateIndexWithOptions
public Completable rxCreateIndexWithOptions(String collection, JsonObject key, IndexOptions options)
Creates an index.- Parameters:
collection
- the collectionkey
- A document that contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.options
- the options for the index- Returns:
- a future notified when complete
-
createIndexes
public Completable createIndexes(String collection, List<IndexModel> indexes)
creates an indexes- Parameters:
collection
- the collectionindexes
- A model that contains pairs of document and indexOptions, document contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.- Returns:
- a future notified when complete
-
rxCreateIndexes
public Completable rxCreateIndexes(String collection, List<IndexModel> indexes)
creates an indexes- Parameters:
collection
- the collectionindexes
- A model that contains pairs of document and indexOptions, document contains the field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of 1; for descending index, specify a value of -1.- Returns:
- a future notified when complete
-
listIndexes
public Single<JsonArray> listIndexes(String collection)
Get all the indexes in this collection.- Parameters:
collection
- the collection- Returns:
- a future notified when complete
-
rxListIndexes
public Single<JsonArray> rxListIndexes(String collection)
Get all the indexes in this collection.- Parameters:
collection
- the collection- Returns:
- a future notified when complete
-
dropIndex
public Completable dropIndex(String collection, String indexName)
Drops the index given its name.- Parameters:
collection
- the collectionindexName
- the name of the index to remove- Returns:
- a future notified when complete
-
rxDropIndex
public Completable rxDropIndex(String collection, String indexName)
Drops the index given its name.- Parameters:
collection
- the collectionindexName
- the name of the index to remove- Returns:
- a future notified when complete
-
dropIndex
public Completable dropIndex(String collection, JsonObject key)
Drops the index given the keys used to create it.- Parameters:
collection
- the collectionkey
- the key(s) of the index to remove- Returns:
- a future notified when complete
-
rxDropIndex
public Completable rxDropIndex(String collection, JsonObject key)
Drops the index given the keys used to create it.- Parameters:
collection
- the collectionkey
- the key(s) of the index to remove- Returns:
- a future notified when complete
-
runCommand
public Maybe<JsonObject> runCommand(String commandName, JsonObject command)
Run an arbitrary MongoDB command.- Parameters:
commandName
- the name of the commandcommand
- the command- Returns:
- a future notified with the result.
-
rxRunCommand
public Maybe<JsonObject> rxRunCommand(String commandName, JsonObject command)
Run an arbitrary MongoDB command.- Parameters:
commandName
- the name of the commandcommand
- the command- Returns:
- a future notified with the result.
-
distinct
public Single<JsonArray> distinct(String collection, String fieldName, String resultClassname)
Gets the distinct values of the specified field name. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-- Returns:
- a future provided with array of values.
-
rxDistinct
public Single<JsonArray> rxDistinct(String collection, String fieldName, String resultClassname)
Gets the distinct values of the specified field name. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-- Returns:
- a future provided with array of values.
-
distinct
public Single<JsonArray> distinct(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-distinctOptions
- options (e.g. collation)- Returns:
- a future provided with array of values.
-
rxDistinct
public Single<JsonArray> rxDistinct(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-distinctOptions
- options (e.g. collation)- Returns:
- a future provided with array of values.
-
distinctWithQuery
public Single<JsonArray> distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
Gets the distinct values of the specified field name filtered by specified query. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the query- Returns:
- a future provided with array of values.
-
rxDistinctWithQuery
public Single<JsonArray> rxDistinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
Gets the distinct values of the specified field name filtered by specified query. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the query- Returns:
- a future provided with array of values.
-
distinctWithQuery
public Single<JsonArray> distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the querydistinctOptions
- options (e.g. collation)- Returns:
- a future provided with array of values.
-
rxDistinctWithQuery
public Single<JsonArray> rxDistinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query. Return a JsonArray containing distinct values (eg: [ 1 , 89 ])- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the querydistinctOptions
- options (e.g. collation)- Returns:
- a future provided with array of values.
-
distinctBatch
public ReadStream<JsonObject> distinctBatch(String collection, String fieldName, String resultClassname)
Gets the distinct values of the specified field name. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-- Returns:
- a emitting json fragments
-
distinctBatch
public ReadStream<JsonObject> distinctBatch(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-distinctOptions
- options (e.g. collation)- Returns:
- a emitting json fragments
-
distinctBatchWithQuery
public ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the query- Returns:
- a emitting json fragments
-
distinctBatchWithQuery
public ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the querydistinctOptions
- options (e.g. collation)- Returns:
- a emitting json fragments
-
distinctBatchWithQuery
public ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize)
Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the querybatchSize
- the number of documents to load in a batch- Returns:
- a emitting json fragments
-
distinctBatchWithQuery
public ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize, DistinctOptions distinctOptions)
Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).- Parameters:
collection
- the collectionfieldName
- the field nameresultClassname
-query
- the querybatchSize
- the number of documents to load in a batchdistinctOptions
- options (e.g. collation)- Returns:
- a emitting json fragments
-
aggregate
public ReadStream<JsonObject> aggregate(String collection, JsonArray pipeline)
Run aggregate MongoDB command with defaultAggregateOptions
.- Parameters:
collection
- the collectionpipeline
- aggregation pipeline to be executed- Returns:
-
aggregateWithOptions
public ReadStream<JsonObject> aggregateWithOptions(String collection, JsonArray pipeline, AggregateOptions options)
Run aggregate MongoDB command.- Parameters:
collection
- the collectionpipeline
- aggregation pipeline to be executedoptions
- options to configure the aggregation command- Returns:
-
createDefaultGridFsBucketService
public Single<MongoGridFsClient> createDefaultGridFsBucketService()
Creates aMongoGridFsClient
used to interact with Mongo GridFS.- Returns:
- a future notified with the
MongoGridFsClient
to interact with the bucket named bucketName
-
rxCreateDefaultGridFsBucketService
public Single<MongoGridFsClient> rxCreateDefaultGridFsBucketService()
Creates aMongoGridFsClient
used to interact with Mongo GridFS.- Returns:
- a future notified with the
MongoGridFsClient
to interact with the bucket named bucketName
-
createGridFsBucketService
public Single<MongoGridFsClient> createGridFsBucketService(String bucketName)
Creates aMongoGridFsClient
used to interact with Mongo GridFS.- Parameters:
bucketName
- the name of the GridFS bucket- Returns:
- a future notified with the
MongoGridFsClient
to interact with the bucket named bucketName
-
rxCreateGridFsBucketService
public Single<MongoGridFsClient> rxCreateGridFsBucketService(String bucketName)
Creates aMongoGridFsClient
used to interact with Mongo GridFS.- Parameters:
bucketName
- the name of the GridFS bucket- Returns:
- a future notified with the
MongoGridFsClient
to interact with the bucket named bucketName
-
close
public Completable close()
Close the client and release its resources- Returns:
-
rxClose
public Completable rxClose()
Close the client and release its resources- Returns:
-
watch
public ReadStream<com.mongodb.client.model.changestream.ChangeStreamDocument<JsonObject>> watch(String collection, JsonArray pipeline, boolean withUpdatedDoc, int batchSize)
Watch the collection change.- Parameters:
collection
- the collectionpipeline
- watching pipeline to be executedwithUpdatedDoc
- whether to get updated fullDocument for "update" operationbatchSize
- the number of documents to load in a batch- Returns:
-
newInstance
public static MongoClient newInstance(MongoClient arg)
-
-