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, createShared
static 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)
MongoClient
This operation might change _id field of document parameter
save
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of document parameter
saveWithOptions
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of document parameter
insert
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of document parameter
insertWithOptions
in interface MongoClient
collection
- 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)
MongoClient
update
in interface MongoClient
collection
- 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)
MongoClient
updateCollection
in interface MongoClient
collection
- 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)
MongoClient
updateWithOptions
in interface MongoClient
collection
- 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)
MongoClient
updateCollectionWithOptions
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of replace parameter
replace
in interface MongoClient
collection
- 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)
MongoClient
replaceDocuments
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of replace parameter
replaceWithOptions
in interface MongoClient
collection
- 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)
MongoClient
replaceDocumentsWithOptions
in interface MongoClient
collection
- 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)
MongoClient
bulkWrite
in interface MongoClient
collection
- 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)
MongoClient
bulkWriteWithOptions
in interface MongoClient
collection
- 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)
MongoClient
find
in interface MongoClient
collection
- the collectionquery
- query used to match documentsresultHandler
- will be provided with list of documentsdefault ReadStream<JsonObject> findBatch(String collection, JsonObject query)
MongoClient
findBatch
in interface MongoClient
collection
- the collectionquery
- query used to match documentsReadStream
emitting found documentsMongoService findWithOptions(String collection, JsonObject query, FindOptions options, Handler<AsyncResult<List<JsonObject>>> resultHandler)
MongoClient
findWithOptions
in interface MongoClient
collection
- 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)
MongoClient
findBatchWithOptions
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of query parameter
findOne
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of query parameter
findOneAndUpdate
in interface MongoClient
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 anyMongoService findOneAndUpdateWithOptions(String collection, JsonObject query, JsonObject update, FindOptions findOptions, UpdateOptions updateOptions, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClient
This operation might change _id field of query parameter
findOneAndUpdateWithOptions
in interface MongoClient
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 anyMongoService findOneAndReplace(String collection, JsonObject query, JsonObject replace, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClient
This operation might change _id field of query parameter
findOneAndReplace
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of query parameter
findOneAndReplaceWithOptions
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of query parameter
findOneAndDelete
in interface MongoClient
collection
- 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)
MongoClient
This operation might change _id field of query parameter
findOneAndDeleteWithOptions
in interface MongoClient
collection
- 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)
MongoClient
count
in interface MongoClient
collection
- 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)
MongoClient
remove
in interface MongoClient
collection
- the collectionquery
- query used to match documentsresultHandler
- will be called when completeMongoService removeDocuments(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClient
removeDocuments
in interface MongoClient
collection
- 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)
MongoClient
removeWithOptions
in interface MongoClient
collection
- 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)
MongoClient
removeDocumentsWithOptions
in interface MongoClient
collection
- 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)
MongoClient
removeOne
in interface MongoClient
collection
- the collectionquery
- query used to match documentresultHandler
- will be called when completeMongoService removeDocument(String collection, JsonObject query, Handler<AsyncResult<MongoClientDeleteResult>> resultHandler)
MongoClient
removeDocument
in interface MongoClient
collection
- 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)
MongoClient
removeOneWithOptions
in interface MongoClient
collection
- 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)
MongoClient
removeDocumentWithOptions
in interface MongoClient
collection
- the collectionquery
- query used to match documentwriteOption
- the write option to useresultHandler
- will be called when completeMongoService createCollection(String collectionName, Handler<AsyncResult<Void>> resultHandler)
MongoClient
createCollection
in interface MongoClient
collectionName
- the name of the collectionresultHandler
- will be called when completeMongoService getCollections(Handler<AsyncResult<List<String>>> resultHandler)
MongoClient
getCollections
in interface MongoClient
resultHandler
- will be called with a list of collections.MongoService dropCollection(String collection, Handler<AsyncResult<Void>> resultHandler)
MongoClient
dropCollection
in interface MongoClient
collection
- the collectionresultHandler
- will be called when completeMongoService createIndex(String collection, JsonObject key, Handler<AsyncResult<Void>> resultHandler)
MongoClient
createIndex
in interface MongoClient
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 completeMongoService createIndexWithOptions(String collection, JsonObject key, IndexOptions options, Handler<AsyncResult<Void>> resultHandler)
MongoClient
createIndexWithOptions
in interface MongoClient
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 completeMongoService listIndexes(String collection, Handler<AsyncResult<JsonArray>> resultHandler)
MongoClient
listIndexes
in interface MongoClient
collection
- the collectionresultHandler
- will be called when completeMongoService dropIndex(String collection, String indexName, Handler<AsyncResult<Void>> resultHandler)
MongoClient
dropIndex
in interface MongoClient
collection
- the collectionindexName
- the name of the index to removeresultHandler
- will be called when completeMongoService runCommand(String commandName, JsonObject command, Handler<AsyncResult<JsonObject>> resultHandler)
MongoClient
runCommand
in interface MongoClient
commandName
- 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)
MongoClient
distinct
in interface MongoClient
collection
- the collectionfieldName
- the field nameresultHandler
- will be provided with array of values.default ReadStream<JsonObject> distinctBatch(String collection, String fieldName, String resultClassname)
MongoClient
distinctBatch
in interface MongoClient
collection
- the collectionfieldName
- the field nameReadStream
emitting json fragmentsMongoService distinctWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, Handler<AsyncResult<JsonArray>> resultHandler)
MongoClient
distinctWithQuery
in interface MongoClient
collection
- 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)
MongoClient
distinctBatchWithQuery
in interface MongoClient
collection
- the collectionfieldName
- the field namequery
- the queryReadStream
emitting json fragmentsdefault ReadStream<JsonObject> distinctBatchWithQuery(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize)
MongoClient
distinctBatchWithQuery
in interface MongoClient
collection
- 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)
MongoClient
AggregateOptions
.aggregate
in interface MongoClient
collection
- the collectionpipeline
- aggregation pipeline to be executeddefault ReadStream<JsonObject> aggregateWithOptions(String collection, JsonArray pipeline, AggregateOptions options)
MongoClient
aggregateWithOptions
in interface MongoClient
collection
- the collectionpipeline
- aggregation pipeline to be executedoptions
- options to configure the aggregation commandvoid close()
MongoClient
close
in interface MongoClient
Copyright © 2023 Eclipse. All rights reserved.