public interface MongoClient
Some of the operations might change _id field of passed JsonObject
document.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DB_NAME
The name of the default database
|
static String |
DEFAULT_POOL_NAME
The name of the default pool
|
Modifier and Type | Method and Description |
---|---|
ReadStream<JsonObject> |
aggregate(String collection,
JsonArray pipeline)
Run aggregate MongoDB command with default
AggregateOptions . |
ReadStream<JsonObject> |
aggregateWithOptions(String collection,
JsonArray pipeline,
AggregateOptions options)
Run aggregate MongoDB command.
|
Future<MongoClientBulkWriteResult> |
bulkWrite(String collection,
List<BulkOperation> operations)
Like
bulkWrite(String, List, Handler) but returns a Future of the asynchronous result |
MongoClient |
bulkWrite(String collection,
List<BulkOperation> operations,
Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
Execute a bulk operation.
|
Future<MongoClientBulkWriteResult> |
bulkWriteWithOptions(String collection,
List<BulkOperation> operations,
BulkWriteOptions bulkWriteOptions)
Like
bulkWriteWithOptions(String, List, BulkWriteOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
bulkWriteWithOptions(String collection,
List<BulkOperation> operations,
BulkWriteOptions bulkWriteOptions,
Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
Execute a bulk operation with the specified write options.
|
Future<Void> |
close()
Like
close(Handler) but returns a Future of the asynchronous result |
void |
close(Handler<AsyncResult<Void>> handler)
Close the client and release its resources
|
Future<Long> |
count(String collection,
JsonObject query)
Like
count(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
count(String collection,
JsonObject query,
Handler<AsyncResult<Long>> resultHandler)
Count matching documents in a collection.
|
Future<Long> |
countWithOptions(String collection,
JsonObject query,
CountOptions countOptions)
Like
count(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
countWithOptions(String collection,
JsonObject query,
CountOptions countOptions,
Handler<AsyncResult<Long>> resultHandler)
Count matching documents in a collection.
|
static MongoClient |
create(Vertx vertx,
JsonObject config)
Create a Mongo client which maintains its own data source.
|
Future<Void> |
createCollection(String collectionName)
Like
createCollection(String, Handler) but returns a Future of the asynchronous result |
MongoClient |
createCollection(String collectionName,
Handler<AsyncResult<Void>> resultHandler)
Create a new collection
|
Future<Void> |
createCollectionWithOptions(String collectionName,
CreateCollectionOptions collectionOptions)
Like
createCollection(String, Handler) but with options and returns a Future of the asynchronous result |
MongoClient |
createCollectionWithOptions(String collectionName,
CreateCollectionOptions collectionOptions,
Handler<AsyncResult<Void>> resultHandler)
Create a new collection with options
|
Future<MongoGridFsClient> |
createDefaultGridFsBucketService()
Like
createDefaultGridFsBucketService(Handler) but returns a Future of the asynchronous result |
MongoClient |
createDefaultGridFsBucketService(Handler<AsyncResult<MongoGridFsClient>> resultHandler)
Creates a
MongoGridFsClient used to interact with Mongo GridFS. |
Future<MongoGridFsClient> |
createGridFsBucketService(String bucketName)
Like
createGridFsBucketService(String, Handler) but returns a Future of the asynchronous result |
MongoClient |
createGridFsBucketService(String bucketName,
Handler<AsyncResult<MongoGridFsClient>> resultHandler)
Creates a
MongoGridFsClient used to interact with Mongo GridFS. |
Future<Void> |
createIndex(String collection,
JsonObject key)
Like
createIndex(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
createIndex(String collection,
JsonObject key,
Handler<AsyncResult<Void>> resultHandler)
Creates an index.
|
Future<Void> |
createIndexes(String collection,
List<IndexModel> indexes)
Like
createIndexes(String, List, Handler) but returns a Future of the asynchronous result |
MongoClient |
createIndexes(String collection,
List<IndexModel> indexes,
Handler<AsyncResult<Void>> resultHandler)
creates an indexes
|
Future<Void> |
createIndexWithOptions(String collection,
JsonObject key,
IndexOptions options)
Like
createIndexWithOptions(String, JsonObject, IndexOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
createIndexWithOptions(String collection,
JsonObject key,
IndexOptions options,
Handler<AsyncResult<Void>> resultHandler)
Creates an index.
|
static MongoClient |
createShared(Vertx vertx,
JsonObject config)
Like
createShared(io.vertx.core.Vertx, JsonObject, String) but with the default data source name |
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
|
static MongoClient |
createWithMongoSettings(Vertx vertx,
JsonObject config,
String dataSourceName,
com.mongodb.MongoClientSettings settings)
Constructor targeting the jvm, like standard constructor
createShared(Vertx, JsonObject, String) , but it accepts default mongoClientSettings
to configure mongo |
Future<JsonArray> |
distinct(String collection,
String fieldName,
String resultClassname)
Like
distinct(String, String, String, Handler) but returns a Future of the asynchronous result |
Future<JsonArray> |
distinct(String collection,
String fieldName,
String resultClassname,
DistinctOptions distinctOptions)
Like
distinct(String, String, String, DistinctOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
distinct(String collection,
String fieldName,
String resultClassname,
DistinctOptions distinctOptions,
Handler<AsyncResult<JsonArray>> resultHandler)
Gets the distinct values of the specified field name.
|
MongoClient |
distinct(String collection,
String fieldName,
String resultClassname,
Handler<AsyncResult<JsonArray>> resultHandler)
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,
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,
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.
|
Future<JsonArray> |
distinctWithQuery(String collection,
String fieldName,
String resultClassname,
JsonObject query)
Like
distinctWithQuery(String, String, String, JsonObject, Handler) but returns a Future of the asynchronous result |
Future<JsonArray> |
distinctWithQuery(String collection,
String fieldName,
String resultClassname,
JsonObject query,
DistinctOptions distinctOptions)
Like
distinctWithQuery(String, String, String, JsonObject, DistinctOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
distinctWithQuery(String collection,
String fieldName,
String resultClassname,
JsonObject query,
DistinctOptions distinctOptions,
Handler<AsyncResult<JsonArray>> resultHandler)
Gets the distinct values of the specified field name filtered by specified query.
|
MongoClient |
distinctWithQuery(String collection,
String fieldName,
String resultClassname,
JsonObject query,
Handler<AsyncResult<JsonArray>> resultHandler)
Gets the distinct values of the specified field name filtered by specified query.
|
Future<Void> |
dropCollection(String collection)
Like
dropCollection(String, Handler) but returns a Future of the asynchronous result |
MongoClient |
dropCollection(String collection,
Handler<AsyncResult<Void>> resultHandler)
Drop a collection
|
Future<Void> |
dropIndex(String collection,
String indexName)
Like
dropIndex(String, String, Handler) but returns a Future of the asynchronous result |
MongoClient |
dropIndex(String collection,
String indexName,
Handler<AsyncResult<Void>> resultHandler)
Drops the index given its name.
|
Future<List<JsonObject>> |
find(String collection,
JsonObject query)
Like
find(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
find(String collection,
JsonObject query,
Handler<AsyncResult<List<JsonObject>>> resultHandler)
Find matching documents in the specified collection
|
ReadStream<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.
|
Future<JsonObject> |
findOne(String collection,
JsonObject query,
JsonObject fields)
Like
findOne(String, JsonObject, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOne(String collection,
JsonObject query,
JsonObject fields,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection
|
Future<JsonObject> |
findOneAndDelete(String collection,
JsonObject query)
Like
findOneAndDelete(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOneAndDelete(String collection,
JsonObject query,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and delete it.
|
Future<JsonObject> |
findOneAndDeleteWithOptions(String collection,
JsonObject query,
FindOptions findOptions)
Like
findOneAndDeleteWithOptions(String, JsonObject, FindOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOneAndDeleteWithOptions(String collection,
JsonObject query,
FindOptions findOptions,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and delete it.
|
Future<JsonObject> |
findOneAndReplace(String collection,
JsonObject query,
JsonObject replace)
Like
findOneAndReplace(String, JsonObject, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOneAndReplace(String collection,
JsonObject query,
JsonObject replace,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and replace it.
|
Future<JsonObject> |
findOneAndReplaceWithOptions(String collection,
JsonObject query,
JsonObject replace,
FindOptions findOptions,
UpdateOptions updateOptions)
Like
findOneAndReplaceWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOneAndReplaceWithOptions(String collection,
JsonObject query,
JsonObject replace,
FindOptions findOptions,
UpdateOptions updateOptions,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and replace it.
|
Future<JsonObject> |
findOneAndUpdate(String collection,
JsonObject query,
JsonObject update)
Like
findOneAndUpdate(String, JsonObject, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOneAndUpdate(String collection,
JsonObject query,
JsonObject update,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and update it.
|
Future<JsonObject> |
findOneAndUpdateWithOptions(String collection,
JsonObject query,
JsonObject update,
FindOptions findOptions,
UpdateOptions updateOptions)
Like
findOneAndUpdateWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
findOneAndUpdateWithOptions(String collection,
JsonObject query,
JsonObject update,
FindOptions findOptions,
UpdateOptions updateOptions,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and update it.
|
Future<List<JsonObject>> |
findWithOptions(String collection,
JsonObject query,
FindOptions options)
Like
findWithOptions(String, JsonObject, FindOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
findWithOptions(String collection,
JsonObject query,
FindOptions options,
Handler<AsyncResult<List<JsonObject>>> resultHandler)
Find matching documents in the specified collection, specifying options
|
Future<List<String>> |
getCollections()
Like
getCollections(Handler) but returns a Future of the asynchronous result |
MongoClient |
getCollections(Handler<AsyncResult<List<String>>> resultHandler)
Get a list of all collections in the database.
|
Future<String> |
insert(String collection,
JsonObject document)
Like
insert(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
insert(String collection,
JsonObject document,
Handler<AsyncResult<String>> resultHandler)
Insert a document in the specified collection
|
Future<String> |
insertWithOptions(String collection,
JsonObject document,
WriteOption writeOption)
Like
insertWithOptions(String, JsonObject, WriteOption, Handler) but returns a Future of the asynchronous result |
MongoClient |
insertWithOptions(String collection,
JsonObject document,
WriteOption writeOption,
Handler<AsyncResult<String>> resultHandler)
Insert a document in the specified collection with the specified write option
|
Future<JsonArray> |
listIndexes(String collection)
Like
listIndexes(String, Handler) but returns a Future of the asynchronous result |
MongoClient |
listIndexes(String collection,
Handler<AsyncResult<JsonArray>> resultHandler)
Get all the indexes in this collection.
|
Future<MongoClientDeleteResult> |
removeDocument(String collection,
JsonObject query)
Like
removeDocument(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
removeDocument(String collection,
JsonObject query,
Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
Remove a single matching document from a collection and return the handler with
MongoClientDeleteResult result |
Future<MongoClientDeleteResult> |
removeDocuments(String collection,
JsonObject query)
Like
removeDocuments(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
removeDocuments(String collection,
JsonObject query,
Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
Remove matching documents from a collection and return the handler with
MongoClientDeleteResult result |
Future<MongoClientDeleteResult> |
removeDocumentsWithOptions(String collection,
JsonObject query,
WriteOption writeOption)
Like
removeDocumentsWithOptions(String, JsonObject, WriteOption, Handler) but returns a Future of the asynchronous result |
MongoClient |
removeDocumentsWithOptions(String collection,
JsonObject query,
WriteOption writeOption,
Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
Remove matching documents from a collection with the specified write option and return the handler with
MongoClientDeleteResult result |
Future<MongoClientDeleteResult> |
removeDocumentWithOptions(String collection,
JsonObject query,
WriteOption writeOption)
Like
removeDocumentWithOptions(String, JsonObject, WriteOption, Handler) but returns a Future of the asynchronous result |
MongoClient |
removeDocumentWithOptions(String collection,
JsonObject query,
WriteOption writeOption,
Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
Remove a single matching document from a collection with the specified write option and return the handler with
MongoClientDeleteResult result |
Future<MongoClientUpdateResult> |
replaceDocuments(String collection,
JsonObject query,
JsonObject replace)
Like
replaceDocuments(String, JsonObject, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
replaceDocuments(String collection,
JsonObject query,
JsonObject replace,
Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
Replace matching documents in the specified collection and return the handler with
MongoClientUpdateResult result |
Future<MongoClientUpdateResult> |
replaceDocumentsWithOptions(String collection,
JsonObject query,
JsonObject replace,
UpdateOptions options)
Like
replaceDocumentsWithOptions(String, JsonObject, JsonObject, UpdateOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
replaceDocumentsWithOptions(String collection,
JsonObject query,
JsonObject replace,
UpdateOptions options,
Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
Replace matching documents in the specified collection, specifying options and return the handler with
MongoClientUpdateResult result |
Future<JsonObject> |
runCommand(String commandName,
JsonObject command)
Like
runCommand(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
runCommand(String commandName,
JsonObject command,
Handler<AsyncResult<JsonObject>> resultHandler)
Run an arbitrary MongoDB command.
|
Future<String> |
save(String collection,
JsonObject document)
Like
save(String, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
save(String collection,
JsonObject document,
Handler<AsyncResult<String>> resultHandler)
Save a document in the specified collection
|
Future<String> |
saveWithOptions(String collection,
JsonObject document,
WriteOption writeOption)
Like
saveWithOptions(String, JsonObject, WriteOption, Handler) but returns a Future of the asynchronous result |
MongoClient |
saveWithOptions(String collection,
JsonObject document,
WriteOption writeOption,
Handler<AsyncResult<String>> resultHandler)
Save a document in the specified collection with the specified write option
|
Future<MongoClientUpdateResult> |
updateCollection(String collection,
JsonObject query,
JsonArray update)
Like
updateCollection(String, JsonObject, JsonArray, Handler) but returns a Future of the asynchronous result |
MongoClient |
updateCollection(String collection,
JsonObject query,
JsonArray update,
Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
Use an aggregation pipeline to update documents in the specified collection and return the handler with
MongoClientUpdateResult result |
Future<MongoClientUpdateResult> |
updateCollection(String collection,
JsonObject query,
JsonObject update)
Like
updateCollection(String, JsonObject, JsonObject, Handler) but returns a Future of the asynchronous result |
MongoClient |
updateCollection(String collection,
JsonObject query,
JsonObject update,
Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
Update matching documents in the specified collection and return the handler with
MongoClientUpdateResult result |
Future<MongoClientUpdateResult> |
updateCollectionWithOptions(String collection,
JsonObject query,
JsonArray update,
UpdateOptions options)
Like
updateCollectionWithOptions(String, JsonObject, JsonArray, UpdateOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
updateCollectionWithOptions(String collection,
JsonObject query,
JsonArray update,
UpdateOptions options,
Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
Use an aggregation pipeline to update documents in the specified collection, specifying options and return the handler with
MongoClientUpdateResult result |
Future<MongoClientUpdateResult> |
updateCollectionWithOptions(String collection,
JsonObject query,
JsonObject update,
UpdateOptions options)
Like
updateCollectionWithOptions(String, JsonObject, JsonObject, UpdateOptions, Handler) but returns a Future of the asynchronous result |
MongoClient |
updateCollectionWithOptions(String collection,
JsonObject query,
JsonObject update,
UpdateOptions options,
Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
Update matching documents in the specified collection, specifying options and return the handler with
MongoClientUpdateResult result |
ReadStream<com.mongodb.client.model.changestream.ChangeStreamDocument<JsonObject>> |
watch(String collection,
JsonArray pipeline,
boolean withUpdatedDoc,
int batchSize)
Watch the collection change.
|
static final String DEFAULT_POOL_NAME
static final String DEFAULT_DB_NAME
static MongoClient create(Vertx vertx, JsonObject config)
vertx
- the Vert.x instanceconfig
- the configurationstatic MongoClient createShared(Vertx vertx, JsonObject config, String dataSourceName)
vertx
- the Vert.x instanceconfig
- the configurationdataSourceName
- the data source namestatic MongoClient createShared(Vertx vertx, JsonObject config)
createShared(io.vertx.core.Vertx, JsonObject, String)
but with the default data source namevertx
- the Vert.x instanceconfig
- the configurationstatic MongoClient createWithMongoSettings(Vertx vertx, JsonObject config, String dataSourceName, com.mongodb.MongoClientSettings settings)
createShared(Vertx, JsonObject, String)
, but it accepts default mongoClientSettings
to configure mongovertx
- the Vert.x instanceconfig
- the configuration use only to provide objectId and database namedataSourceName
- the data source namesettings
- the native java mongo settingsMongoClient save(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)
This operation might change _id field of document parameter
collection
- the collectiondocument
- the documentresultHandler
- result handler will be provided with the id if document didn't already have oneFuture<String> save(String collection, JsonObject document)
save(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient saveWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)
This operation might change _id field of document parameter
collection
- the collectiondocument
- the documentwriteOption
- the write option to useresultHandler
- result handler will be provided with the id if document didn't already have oneFuture<String> saveWithOptions(String collection, JsonObject document, WriteOption writeOption)
saveWithOptions(String, JsonObject, WriteOption, Handler)
but returns a Future
of the asynchronous resultMongoClient insert(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)
This operation might change _id field of document parameter
collection
- the collectiondocument
- the documentresultHandler
- result handler will be provided with the id if document didn't already have oneFuture<String> insert(String collection, JsonObject document)
insert(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient insertWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)
This operation might change _id field of document parameter
collection
- the collectiondocument
- the documentwriteOption
- the write option to useresultHandler
- result handler will be provided with the id if document didn't already have oneFuture<String> insertWithOptions(String collection, JsonObject document, WriteOption writeOption)
insertWithOptions(String, JsonObject, WriteOption, Handler)
but returns a Future
of the asynchronous resultMongoClient updateCollection(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientUpdateResult
resultcollection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updatedresultHandler
- will be called with a MongoClientUpdateResult
when completeFuture<MongoClientUpdateResult> updateCollection(String collection, JsonObject query, JsonObject update)
updateCollection(String, JsonObject, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient updateCollection(String collection, JsonObject query, JsonArray update, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientUpdateResult
resultcollection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updatedresultHandler
- will be called with a MongoClientUpdateResult
when completeFuture<MongoClientUpdateResult> updateCollection(String collection, JsonObject query, JsonArray update)
updateCollection(String, JsonObject, JsonArray, Handler)
but returns a Future
of the asynchronous resultMongoClient updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientUpdateResult
resultcollection
- the collectionquery
- query used to match the documentsupdate
- used to describe how the documents will be updatedoptions
- options to configure the updateresultHandler
- will be called with a MongoClientUpdateResult
when completeFuture<MongoClientUpdateResult> updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options)
updateCollectionWithOptions(String, JsonObject, JsonObject, UpdateOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient updateCollectionWithOptions(String collection, JsonObject query, JsonArray update, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientUpdateResult
resultcollection
- the collectionquery
- query used to match the documentsupdate
- aggregation pipeline used to describe how documents will be updatedoptions
- options to configure the updateresultHandler
- will be called with a MongoClientUpdateResult
when completeFuture<MongoClientUpdateResult> updateCollectionWithOptions(String collection, JsonObject query, JsonArray update, UpdateOptions options)
updateCollectionWithOptions(String, JsonObject, JsonArray, UpdateOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient replaceDocuments(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientUpdateResult
resultcollection
- the collectionquery
- query used to match the documentsreplace
- all matching documents will be replaced with thisresultHandler
- will be called with a MongoClientUpdateResult
when completeFuture<MongoClientUpdateResult> replaceDocuments(String collection, JsonObject query, JsonObject replace)
replaceDocuments(String, JsonObject, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientUpdateResult
resultcollection
- the collectionquery
- query used to match the documentsreplace
- all matching documents will be replaced with thisoptions
- options to configure the replaceresultHandler
- will be called with a MongoClientUpdateResult
when completeFuture<MongoClientUpdateResult> replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options)
replaceDocumentsWithOptions(String, JsonObject, JsonObject, UpdateOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient bulkWrite(String collection, List<BulkOperation> operations, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
collection
- the collectionoperations
- the operations to executeresultHandler
- will be called with a MongoClientBulkWriteResult
when completeFuture<MongoClientBulkWriteResult> bulkWrite(String collection, List<BulkOperation> operations)
bulkWrite(String, List, Handler)
but returns a Future
of the asynchronous resultMongoClient bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
collection
- the collectionoperations
- the operations to executebulkWriteOptions
- the write optionsresultHandler
- will be called with a MongoClientBulkWriteResult
when completeFuture<MongoClientBulkWriteResult> bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions)
bulkWriteWithOptions(String, List, BulkWriteOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient find(String collection, JsonObject query, Handler<AsyncResult<List<JsonObject>>> resultHandler)
collection
- the collectionquery
- query used to match documentsresultHandler
- will be provided with list of documentsFuture<List<JsonObject>> find(String collection, JsonObject query)
find(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultReadStream<JsonObject> findBatch(String collection, JsonObject query)
collection
- the collectionquery
- query used to match documentsReadStream
emitting found documentsMongoClient findWithOptions(String collection, JsonObject query, FindOptions options, Handler<AsyncResult<List<JsonObject>>> resultHandler)
collection
- the collectionquery
- query used to match documentsoptions
- options to configure the findresultHandler
- will be provided with list of documentsFuture<List<JsonObject>> findWithOptions(String collection, JsonObject query, FindOptions options)
findWithOptions(String, JsonObject, FindOptions, Handler)
but returns a Future
of the asynchronous resultReadStream<JsonObject> findBatchWithOptions(String collection, JsonObject query, FindOptions options)
collection
- the collectionquery
- query used to match documentsoptions
- options to configure the findReadStream
emitting found documentsMongoClient findOne(String collection, JsonObject query, JsonObject fields, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
collection
- the collectionquery
- the query used to match the documentfields
- the fieldsresultHandler
- will be provided with the document, if anyFuture<JsonObject> findOne(String collection, JsonObject query, JsonObject fields)
findOne(String, JsonObject, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient findOneAndUpdate(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
collection
- the collectionquery
- the query used to match the documentupdate
- used to describe how the documents will be updatedresultHandler
- will be provided with the document, if anyFuture<JsonObject> findOneAndUpdate(String collection, JsonObject query, JsonObject update)
findOneAndUpdate(String, JsonObject, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
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 updateresultHandler
- will be provided with the document, if anyFuture<JsonObject> findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions)
findOneAndUpdateWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient findOneAndReplace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
collection
- the collectionquery
- the query used to match the documentreplace
- the replacement documentresultHandler
- will be provided with the document, if anyFuture<JsonObject> findOneAndReplace(String collection, JsonObject query, JsonObject replace)
findOneAndReplace(String, JsonObject, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
collection
- the collectionquery
- the query used to match the documentreplace
- the replacement documentfindOptions
- options to configure the findupdateOptions
- options to configure the updateresultHandler
- will be provided with the document, if anyFuture<JsonObject> findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject replace, FindOptions findOptions, UpdateOptions updateOptions)
findOneAndReplaceWithOptions(String, JsonObject, JsonObject, FindOptions, UpdateOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient findOneAndDelete(String collection, JsonObject query, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
collection
- the collectionquery
- the query used to match the documentresultHandler
- will be provided with the deleted document, if anyFuture<JsonObject> findOneAndDelete(String collection, JsonObject query)
findOneAndDelete(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions, Handler<AsyncResult<JsonObject>> resultHandler)
This operation might change _id field of query parameter
collection
- the collectionquery
- the query used to match the documentfindOptions
- options to configure the findresultHandler
- will be provided with the deleted document, if anyFuture<JsonObject> findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions)
findOneAndDeleteWithOptions(String, JsonObject, FindOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler)
collection
- the collectionquery
- query used to match documentsresultHandler
- will be provided with the number of matching documentsFuture<Long> count(String collection, JsonObject query)
count(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient countWithOptions(String collection, JsonObject query, CountOptions countOptions, Handler<AsyncResult<Long>> resultHandler)
collection
- the collectionquery
- query used to match documentscountOptions
- resultHandler
- will be provided with the number of matching documentsFuture<Long> countWithOptions(String collection, JsonObject query, CountOptions countOptions)
count(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient removeDocuments(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientDeleteResult
resultcollection
- the collectionquery
- query used to match documentsresultHandler
- will be called with a MongoClientDeleteResult
when completeFuture<MongoClientDeleteResult> removeDocuments(String collection, JsonObject query)
removeDocuments(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientDeleteResult
resultcollection
- the collectionquery
- query used to match documentswriteOption
- the write option to useresultHandler
- will be called with a MongoClientDeleteResult
when completeFuture<MongoClientDeleteResult> removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption)
removeDocumentsWithOptions(String, JsonObject, WriteOption, Handler)
but returns a Future
of the asynchronous resultMongoClient removeDocument(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientDeleteResult
resultcollection
- the collectionquery
- query used to match documentresultHandler
- will be called with a MongoClientDeleteResult
when completeFuture<MongoClientDeleteResult> removeDocument(String collection, JsonObject query)
removeDocument(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientDeleteResult
resultcollection
- the collectionquery
- query used to match documentwriteOption
- the write option to useresultHandler
- will be called with a MongoClientDeleteResult
when completeFuture<MongoClientDeleteResult> removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption)
removeDocumentWithOptions(String, JsonObject, WriteOption, Handler)
but returns a Future
of the asynchronous resultMongoClient createCollection(String collectionName, Handler<AsyncResult<Void>> resultHandler)
collectionName
- the name of the collectionresultHandler
- will be called when completeMongoClient createCollectionWithOptions(String collectionName, CreateCollectionOptions collectionOptions, Handler<AsyncResult<Void>> resultHandler)
collectionName
- the name of the collectioncollectionOptions
- options of the collectionresultHandler
- will be called when completeFuture<Void> createCollection(String collectionName)
createCollection(String, Handler)
but returns a Future
of the asynchronous resultFuture<Void> createCollectionWithOptions(String collectionName, CreateCollectionOptions collectionOptions)
createCollection(String, Handler)
but with options and returns a Future
of the asynchronous resultMongoClient getCollections(Handler<AsyncResult<List<String>>> resultHandler)
resultHandler
- will be called with a list of collections.Future<List<String>> getCollections()
getCollections(Handler)
but returns a Future
of the asynchronous resultMongoClient dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler)
collection
- the collectionresultHandler
- will be called when completeFuture<Void> dropCollection(String collection)
dropCollection(String, Handler)
but returns a Future
of the asynchronous resultMongoClient createIndex(String collection, JsonObject key, Handler<AsyncResult<Void>> resultHandler)
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.resultHandler
- will be called when completeFuture<Void> createIndex(String collection, JsonObject key)
createIndex(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient createIndexWithOptions(String collection, JsonObject key, IndexOptions options, Handler<AsyncResult<Void>> resultHandler)
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 indexresultHandler
- will be called when completeFuture<Void> createIndexWithOptions(String collection, JsonObject key, IndexOptions options)
createIndexWithOptions(String, JsonObject, IndexOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient createIndexes(String collection, List<IndexModel> indexes, Handler<AsyncResult<Void>> resultHandler)
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.resultHandler
- will be called when completeFuture<Void> createIndexes(String collection, List<IndexModel> indexes)
createIndexes(String, List, Handler)
but returns a Future
of the asynchronous resultMongoClient listIndexes(String collection, Handler<AsyncResult<JsonArray>> resultHandler)
collection
- the collectionresultHandler
- will be called when completeFuture<JsonArray> listIndexes(String collection)
listIndexes(String, Handler)
but returns a Future
of the asynchronous resultMongoClient dropIndex(String collection, String indexName, Handler<AsyncResult<Void>> resultHandler)
collection
- the collectionindexName
- the name of the index to removeresultHandler
- will be called when completeFuture<Void> dropIndex(String collection, String indexName)
dropIndex(String, String, Handler)
but returns a Future
of the asynchronous resultMongoClient runCommand(String commandName, JsonObject command, Handler<AsyncResult<JsonObject>> resultHandler)
commandName
- the name of the commandcommand
- the commandresultHandler
- will be called with the result.Future<JsonObject> runCommand(String commandName, JsonObject command)
runCommand(String, JsonObject, Handler)
but returns a Future
of the asynchronous resultMongoClient distinct(String collection, String fieldName, String resultClassname, Handler<AsyncResult<JsonArray>> resultHandler)
collection
- the collectionfieldName
- the field nameresultHandler
- will be provided with array of values.MongoClient distinct(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions, Handler<AsyncResult<JsonArray>> resultHandler)
collection
- the collectionfieldName
- the field namedistinctOptions
- options (e.g. collation)resultHandler
- will be provided with array of values.Future<JsonArray> distinct(String collection, String fieldName, String resultClassname)
distinct(String, String, String, Handler)
but returns a Future
of the asynchronous resultFuture<JsonArray> distinct(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
distinct(String, String, String, DistinctOptions, Handler)
but returns a Future
of the asynchronous resultMongoClient distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, Handler<AsyncResult<JsonArray>> resultHandler)
collection
- the collectionfieldName
- the field namequery
- the queryresultHandler
- will be provided with array of values.MongoClient distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions, Handler<AsyncResult<JsonArray>> resultHandler)
collection
- the collectionfieldName
- the field namequery
- the querydistinctOptions
- options (e.g. collation)resultHandler
- will be provided with array of values.Future<JsonArray> distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
distinctWithQuery(String, String, String, JsonObject, Handler)
but returns a Future
of the asynchronous resultFuture<JsonArray> distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
distinctWithQuery(String, String, String, JsonObject, DistinctOptions, Handler)
but returns a Future
of the asynchronous resultReadStream<JsonObject> distinctBatch(String collection, String fieldName, String resultClassname)
collection
- the collectionfieldName
- the field nameReadStream
emitting json fragmentsReadStream<JsonObject> distinctBatch(String collection, String fieldName, String resultClassname, DistinctOptions distinctOptions)
collection
- the collectionfieldName
- the field namedistinctOptions
- options (e.g. collation)ReadStream
emitting json fragmentsReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
collection
- the collectionfieldName
- the field namequery
- the queryReadStream
emitting json fragmentsReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions distinctOptions)
collection
- the collectionfieldName
- the field namequery
- the querydistinctOptions
- options (e.g. collation)ReadStream
emitting json fragmentsReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize)
collection
- the collectionfieldName
- the field namequery
- the querybatchSize
- the number of documents to load in a batchReadStream
emitting json fragmentsReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize, DistinctOptions distinctOptions)
collection
- the collectionfieldName
- the field namequery
- the querybatchSize
- the number of documents to load in a batchdistinctOptions
- options (e.g. collation)ReadStream
emitting json fragmentsReadStream<JsonObject> aggregate(String collection, JsonArray pipeline)
AggregateOptions
.collection
- the collectionpipeline
- aggregation pipeline to be executedReadStream<JsonObject> aggregateWithOptions(String collection, JsonArray pipeline, AggregateOptions options)
collection
- the collectionpipeline
- aggregation pipeline to be executedoptions
- options to configure the aggregation commandReadStream<com.mongodb.client.model.changestream.ChangeStreamDocument<JsonObject>> watch(String collection, JsonArray pipeline, boolean withUpdatedDoc, int batchSize)
collection
- the collectionpipeline
- watching pipeline to be executedwithUpdatedDoc
- whether to get updated fullDocument for "update" operationbatchSize
- the number of documents to load in a batchMongoClient createDefaultGridFsBucketService(Handler<AsyncResult<MongoGridFsClient>> resultHandler)
MongoGridFsClient
used to interact with Mongo GridFS.resultHandler
- the MongoGridFsClient
to interact with the bucket named bucketNameFuture<MongoGridFsClient> createDefaultGridFsBucketService()
createDefaultGridFsBucketService(Handler)
but returns a Future
of the asynchronous resultMongoClient createGridFsBucketService(String bucketName, Handler<AsyncResult<MongoGridFsClient>> resultHandler)
MongoGridFsClient
used to interact with Mongo GridFS.bucketName
- the name of the GridFS bucketresultHandler
- the MongoGridFsClient
to interact with the bucket named bucketNameFuture<MongoGridFsClient> createGridFsBucketService(String bucketName)
createGridFsBucketService(String, Handler)
but returns a Future
of the asynchronous resultFuture<Void> close()
close(Handler)
but returns a Future
of the asynchronous resultvoid close(Handler<AsyncResult<Void>> handler)
Copyright © 2024 Eclipse. All rights reserved.