public interface MongoService extends MongoClient
DEFAULT_DB_NAME, DEFAULT_POOL_NAME| Modifier and Type | Method and Description |
|---|---|
default ReadStream<JsonObject> |
aggregate(String collection,
JsonArray pipeline)
Run aggregate MongoDB command with default
AggregateOptions. |
default ReadStream<JsonObject> |
aggregateWithOptions(String collection,
JsonArray pipeline,
AggregateOptions options)
Run aggregate MongoDB command.
|
MongoService |
bulkWrite(String collection,
List<BulkOperation> operations,
Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
Execute a bulk operation.
|
MongoService |
bulkWriteWithOptions(String collection,
List<BulkOperation> operations,
BulkWriteOptions bulkWriteOptions,
Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
Execute a bulk operation with the specified write options.
|
void |
close()
Close the client and release its resources
|
MongoService |
count(String collection,
JsonObject query,
Handler<AsyncResult<Long>> resultHandler)
Count matching documents in a collection.
|
MongoService |
createCollection(String collectionName,
Handler<AsyncResult<Void>> resultHandler)
Create a new collection
|
static MongoService |
createEventBusProxy(Vertx vertx,
String address)
Create a proxy to a service that is deployed somewhere on the event bus
|
MongoService |
createIndex(String collection,
JsonObject key,
Handler<AsyncResult<Void>> resultHandler)
Creates an index.
|
MongoService |
createIndexWithOptions(String collection,
JsonObject key,
IndexOptions options,
Handler<AsyncResult<Void>> resultHandler)
Creates an index.
|
MongoService |
distinct(String collection,
String fieldName,
String resultClassname,
Handler<AsyncResult<JsonArray>> resultHandler)
Gets the distinct values of the specified field name.
|
default ReadStream<JsonObject> |
distinctBatch(String collection,
String fieldName,
String resultClassname)
Gets the distinct values of the specified field name.
|
default ReadStream<JsonObject> |
distinctBatchWithQuery(String collection,
String fieldName,
String resultClassname,
JsonObject query)
Gets the distinct values of the specified field name filtered by specified query.
|
default 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.
|
MongoService |
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.
|
MongoService |
dropCollection(String collection,
Handler<AsyncResult<Void>> resultHandler)
Drop a collection
|
MongoService |
dropIndex(String collection,
String indexName,
Handler<AsyncResult<Void>> resultHandler)
Drops the index given its name.
|
MongoService |
find(String collection,
JsonObject query,
Handler<AsyncResult<List<JsonObject>>> resultHandler)
Find matching documents in the specified collection
|
default ReadStream<JsonObject> |
findBatch(String collection,
JsonObject query)
Find matching documents in the specified collection.
|
default ReadStream<JsonObject> |
findBatchWithOptions(String collection,
JsonObject query,
FindOptions options)
Find matching documents in the specified collection, specifying options.
|
MongoService |
findOne(String collection,
JsonObject query,
JsonObject fields,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection
|
MongoService |
findOneAndDelete(String collection,
JsonObject query,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and delete it.
|
MongoService |
findOneAndDeleteWithOptions(String collection,
JsonObject query,
FindOptions findOptions,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and delete it.
|
MongoService |
findOneAndReplace(String collection,
JsonObject query,
JsonObject replace,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and replace it.
|
MongoService |
findOneAndReplaceWithOptions(String collection,
JsonObject query,
JsonObject update,
FindOptions findOptions,
UpdateOptions updateOptions,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and replace it.
|
MongoService |
findOneAndUpdate(String collection,
JsonObject query,
JsonObject update,
Handler<AsyncResult<JsonObject>> resultHandler)
Find a single matching document in the specified collection and update it.
|
MongoService |
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.
|
MongoService |
findWithOptions(String collection,
JsonObject query,
FindOptions options,
Handler<AsyncResult<List<JsonObject>>> resultHandler)
Find matching documents in the specified collection, specifying options
|
MongoService |
getCollections(Handler<AsyncResult<List<String>>> resultHandler)
Get a list of all collections in the database.
|
MongoService |
insert(String collection,
JsonObject document,
Handler<AsyncResult<String>> resultHandler)
Insert a document in the specified collection
|
MongoService |
insertWithOptions(String collection,
JsonObject document,
WriteOption writeOption,
Handler<AsyncResult<String>> resultHandler)
Insert a document in the specified collection with the specified write option
|
MongoService |
listIndexes(String collection,
Handler<AsyncResult<JsonArray>> resultHandler)
Get all the indexes in this collection.
|
MongoService |
remove(String collection,
JsonObject query,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
removeDocument(String collection,
JsonObject query,
Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
Remove a single matching document from a collection and return the handler with MongoClientDeleteResult result
|
MongoService |
removeDocuments(String collection,
JsonObject query,
Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
Remove matching documents from a collection and return the handler with MongoClientDeleteResult result
|
MongoService |
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
|
MongoService |
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
|
MongoService |
removeOne(String collection,
JsonObject query,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
removeOneWithOptions(String collection,
JsonObject query,
WriteOption writeOption,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
removeWithOptions(String collection,
JsonObject query,
WriteOption writeOption,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
replace(String collection,
JsonObject query,
JsonObject replace,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
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
|
MongoService |
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
|
MongoService |
replaceWithOptions(String collection,
JsonObject query,
JsonObject replace,
UpdateOptions options,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
runCommand(String commandName,
JsonObject command,
Handler<AsyncResult<JsonObject>> resultHandler)
Run an arbitrary MongoDB command.
|
MongoService |
save(String collection,
JsonObject document,
Handler<AsyncResult<String>> resultHandler)
Save a document in the specified collection
|
MongoService |
saveWithOptions(String collection,
JsonObject document,
WriteOption writeOption,
Handler<AsyncResult<String>> resultHandler)
Save a document in the specified collection with the specified write option
|
MongoService |
update(String collection,
JsonObject query,
JsonObject update,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
MongoService |
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
|
MongoService |
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
|
MongoService |
updateWithOptions(String collection,
JsonObject query,
JsonObject update,
UpdateOptions options,
Handler<AsyncResult<Void>> resultHandler)
Deprecated.
|
create, createNonShared, createShared, createSharedstatic MongoService createEventBusProxy(Vertx vertx, String address)
vertx - the Vert.x instanceaddress - the address the service is listening on on the event busMongoService save(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)
MongoClientThis operation might change _id field of document parameter
save in interface MongoClientcollection - the collectiondocument - the documentresultHandler - result handler will be provided with the id if document didn't already have oneMongoService saveWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)
MongoClientThis operation might change _id field of document parameter
saveWithOptions in interface MongoClientcollection - the collectiondocument - the documentwriteOption - the write option to useresultHandler - result handler will be provided with the id if document didn't already have oneMongoService insert(String collection, JsonObject document, Handler<AsyncResult<String>> resultHandler)
MongoClientThis operation might change _id field of document parameter
insert in interface MongoClientcollection - the collectiondocument - the documentresultHandler - result handler will be provided with the id if document didn't already have oneMongoService insertWithOptions(String collection, JsonObject document, WriteOption writeOption, Handler<AsyncResult<String>> resultHandler)
MongoClientThis operation might change _id field of document parameter
insertWithOptions in interface MongoClientcollection - the collectiondocument - the documentwriteOption - the write option to useresultHandler - result handler will be provided with the id if document didn't already have one@Deprecated MongoService update(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<Void>> resultHandler)
MongoClientupdate in interface MongoClientcollection - the collectionquery - query used to match the documentsupdate - used to describe how the documents will be updatedresultHandler - will be called when completeMongoService updateCollection(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientupdateCollection in interface MongoClientcollection - the collectionquery - query used to match the documentsupdate - used to describe how the documents will be updatedresultHandler - will be called when complete@Deprecated MongoService updateWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options, Handler<AsyncResult<Void>> resultHandler)
MongoClientupdateWithOptions in interface MongoClientcollection - 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 when completeMongoService updateCollectionWithOptions(String collection, JsonObject query, JsonObject update, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientupdateCollectionWithOptions in interface MongoClientcollection - 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 when complete@Deprecated MongoService replace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<Void>> resultHandler)
MongoClientThis operation might change _id field of replace parameter
replace in interface MongoClientcollection - the collectionquery - query used to match the documentsreplace - all matching documents will be replaced with thisresultHandler - will be called when completeMongoService replaceDocuments(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientreplaceDocuments in interface MongoClientcollection - the collectionquery - query used to match the documentsreplace - all matching documents will be replaced with thisresultHandler - will be called when complete@Deprecated MongoService replaceWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options, Handler<AsyncResult<Void>> resultHandler)
MongoClientThis operation might change _id field of replace parameter
replaceWithOptions in interface MongoClientcollection - the collectionquery - query used to match the documentsreplace - all matching documents will be replaced with thisoptions - options to configure the replaceresultHandler - will be called when completeMongoService replaceDocumentsWithOptions(String collection, JsonObject query, JsonObject replace, UpdateOptions options, Handler<AsyncResult<MongoClientUpdateResult>> resultHandler)
MongoClientreplaceDocumentsWithOptions in interface MongoClientcollection - the collectionquery - query used to match the documentsreplace - all matching documents will be replaced with thisoptions - options to configure the replaceresultHandler - will be called when completeMongoService bulkWrite(String collection, List<BulkOperation> operations, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
MongoClientbulkWrite in interface MongoClientcollection - the collectionoperations - the operations to executeresultHandler - will be called with a MongoClientBulkWriteResult when completeMongoService bulkWriteWithOptions(String collection, List<BulkOperation> operations, BulkWriteOptions bulkWriteOptions, Handler<AsyncResult<MongoClientBulkWriteResult>> resultHandler)
MongoClientbulkWriteWithOptions in interface MongoClientcollection - the collectionoperations - the operations to executebulkWriteOptions - the write optionsresultHandler - will be called with a MongoClientBulkWriteResult when completeMongoService find(String collection, JsonObject query, Handler<AsyncResult<List<JsonObject>>> resultHandler)
MongoClientfind in interface MongoClientcollection - the collectionquery - query used to match documentsresultHandler - will be provided with list of documentsdefault ReadStream<JsonObject> findBatch(String collection, JsonObject query)
MongoClientfindBatch in interface MongoClientcollection - the collectionquery - query used to match documentsReadStream emitting found documentsMongoService findWithOptions(String collection, JsonObject query, FindOptions options, Handler<AsyncResult<List<JsonObject>>> resultHandler)
MongoClientfindWithOptions in interface MongoClientcollection - the collectionquery - query used to match documentsoptions - options to configure the findresultHandler - will be provided with list of documentsdefault ReadStream<JsonObject> findBatchWithOptions(String collection, JsonObject query, FindOptions options)
MongoClientfindBatchWithOptions in interface MongoClientcollection - the collectionquery - query used to match documentsoptions - options to configure the findReadStream emitting found documentsMongoService findOne(String collection, JsonObject query, JsonObject fields, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOne in interface MongoClientcollection - the collectionquery - the query used to match the documentfields - the fieldsresultHandler - will be provided with the document, if anyMongoService findOneAndUpdate(String collection, JsonObject query, JsonObject update, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOneAndUpdate in interface MongoClientcollection - 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 anyMongoService findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOneAndUpdateWithOptions in interface MongoClientcollection - 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 anyMongoService findOneAndReplace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOneAndReplace in interface MongoClientcollection - the collectionquery - the query used to match the documentreplace - the replacement documentresultHandler - will be provided with the document, if anyMongoService findOneAndReplaceWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOneAndReplaceWithOptions in interface MongoClientcollection - the collectionquery - the query used to match the documentupdate - the replacement documentfindOptions - options to configure the findupdateOptions - options to configure the updateresultHandler - will be provided with the document, if anyMongoService findOneAndDelete(String collection, JsonObject query, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOneAndDelete in interface MongoClientcollection - the collectionquery - the query used to match the documentresultHandler - will be provided with the deleted document, if anyMongoService findOneAndDeleteWithOptions(String collection, JsonObject query, FindOptions findOptions, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientThis operation might change _id field of query parameter
findOneAndDeleteWithOptions in interface MongoClientcollection - the collectionquery - the query used to match the documentfindOptions - options to configure the findresultHandler - will be provided with the deleted document, if anyMongoService count(String collection, JsonObject query, Handler<AsyncResult<Long>> resultHandler)
MongoClientcount in interface MongoClientcollection - the collectionquery - query used to match documentsresultHandler - will be provided with the number of matching documents@Deprecated MongoService remove(String collection, JsonObject query, Handler<AsyncResult<Void>> resultHandler)
MongoClientremove in interface MongoClientcollection - the collectionquery - query used to match documentsresultHandler - will be called when completeMongoService removeDocuments(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientremoveDocuments in interface MongoClientcollection - the collectionquery - query used to match documentsresultHandler - will be called when complete@Deprecated MongoService removeWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<Void>> resultHandler)
MongoClientremoveWithOptions in interface MongoClientcollection - the collectionquery - query used to match documentswriteOption - the write option to useresultHandler - will be called when completeMongoService removeDocumentsWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientremoveDocumentsWithOptions in interface MongoClientcollection - the collectionquery - query used to match documentswriteOption - the write option to useresultHandler - will be called when complete@Deprecated MongoService removeOne(String collection, JsonObject query, Handler<AsyncResult<Void>> resultHandler)
MongoClientremoveOne in interface MongoClientcollection - the collectionquery - query used to match documentresultHandler - will be called when completeMongoService removeDocument(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientremoveDocument in interface MongoClientcollection - the collectionquery - query used to match documentresultHandler - will be called when complete@Deprecated MongoService removeOneWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<Void>> resultHandler)
MongoClientremoveOneWithOptions in interface MongoClientcollection - the collectionquery - query used to match documentwriteOption - the write option to useresultHandler - will be called when completeMongoService removeDocumentWithOptions(String collection, JsonObject query, WriteOption writeOption, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClientremoveDocumentWithOptions in interface MongoClientcollection - the collectionquery - query used to match documentwriteOption - the write option to useresultHandler - will be called when completeMongoService createCollection(String collectionName, Handler<AsyncResult<Void>> resultHandler)
MongoClientcreateCollection in interface MongoClientcollectionName - the name of the collectionresultHandler - will be called when completeMongoService getCollections(Handler<AsyncResult<List<String>>> resultHandler)
MongoClientgetCollections in interface MongoClientresultHandler - will be called with a list of collections.MongoService dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler)
MongoClientdropCollection in interface MongoClientcollection - the collectionresultHandler - will be called when completeMongoService createIndex(String collection, JsonObject key, Handler<AsyncResult<Void>> resultHandler)
MongoClientcreateIndex in interface MongoClientcollection - 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 completeMongoService createIndexWithOptions(String collection, JsonObject key, IndexOptions options, Handler<AsyncResult<Void>> resultHandler)
MongoClientcreateIndexWithOptions in interface MongoClientcollection - 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 completeMongoService listIndexes(String collection, Handler<AsyncResult<JsonArray>> resultHandler)
MongoClientlistIndexes in interface MongoClientcollection - the collectionresultHandler - will be called when completeMongoService dropIndex(String collection, String indexName, Handler<AsyncResult<Void>> resultHandler)
MongoClientdropIndex in interface MongoClientcollection - the collectionindexName - the name of the index to removeresultHandler - will be called when completeMongoService runCommand(String commandName, JsonObject command, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClientrunCommand in interface MongoClientcommandName - the name of the commandcommand - the commandresultHandler - will be called with the result.MongoService distinct(String collection, String fieldName, String resultClassname, Handler<AsyncResult<JsonArray>> resultHandler)
MongoClientdistinct in interface MongoClientcollection - the collectionfieldName - the field nameresultHandler - will be provided with array of values.default ReadStream<JsonObject> distinctBatch(String collection, String fieldName, String resultClassname)
MongoClientdistinctBatch in interface MongoClientcollection - the collectionfieldName - the field nameReadStream emitting json fragmentsMongoService distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, Handler<AsyncResult<JsonArray>> resultHandler)
MongoClientdistinctWithQuery in interface MongoClientcollection - the collectionfieldName - the field namequery - the queryresultHandler - will be provided with array of values.default ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query)
MongoClientdistinctBatchWithQuery in interface MongoClientcollection - the collectionfieldName - the field namequery - the queryReadStream emitting json fragmentsdefault ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize)
MongoClientdistinctBatchWithQuery in interface MongoClientcollection - the collectionfieldName - the field namequery - the querybatchSize - the number of documents to load in a batchReadStream emitting json fragmentsdefault ReadStream<JsonObject> aggregate(String collection, JsonArray pipeline)
MongoClientAggregateOptions.aggregate in interface MongoClientcollection - the collectionpipeline - aggregation pipeline to be executeddefault ReadStream<JsonObject> aggregateWithOptions(String collection, JsonArray pipeline, AggregateOptions options)
MongoClientaggregateWithOptions in interface MongoClientcollection - the collectionpipeline - aggregation pipeline to be executedoptions - options to configure the aggregation commandvoid close()
MongoClientclose in interface MongoClientCopyright © 2021 Eclipse. All rights reserved.