public class MongoClientDataSource extends java.lang.Object implements MongoDataSource
| Constructor and Description |
|---|
MongoClientDataSource(io.vertx.ext.mongo.MongoClient client) |
| Modifier and Type | Method and Description |
|---|---|
MongoDataSource |
bulkInsert(java.lang.String collection,
java.util.List<io.vertx.core.json.JsonObject> documents,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Insert many documents into the collection.
|
MongoDataSource |
count(java.lang.String collection,
io.vertx.core.json.JsonObject query,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Count matching documents in a collection.
|
MongoDataSource |
createIndex(java.lang.String collection,
Index index,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
Creates an index on the collection.
|
MongoDataSource |
deleteIndex(java.lang.String collection,
java.lang.String name,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
Deletes an index.
|
MongoDataSource |
dropCollection(java.lang.String collection,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
Drops the collection.
|
MongoDataSource |
find(java.lang.String collection,
io.vertx.core.json.JsonObject query,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<io.vertx.core.json.JsonObject>>> resultHandler)
Find matching documents in the specified collection
|
MongoDataSource |
listIndexes(java.lang.String collection,
io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray>> resultHandler)
List all indexes.
|
MongoDataSource |
removeDocuments(java.lang.String collection,
io.vertx.core.json.JsonObject query,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Remove matching documents in a collection.
|
MongoDataSource |
upsert(java.lang.String collection,
io.vertx.core.json.JsonObject document,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>> resultHandler)
Insert or update a document into the collection.
|
public MongoClientDataSource(io.vertx.ext.mongo.MongoClient client)
public MongoDataSource count(java.lang.String collection, io.vertx.core.json.JsonObject query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
MongoDataSourcecount in interface MongoDataSourcecollection - the collectionquery - query used to match documentsresultHandler - will be provided with the number of matching documentspublic MongoDataSource find(java.lang.String collection, io.vertx.core.json.JsonObject query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<io.vertx.core.json.JsonObject>>> resultHandler)
MongoDataSourcefind in interface MongoDataSourcecollection - the collectionquery - query used to match documentsresultHandler - will be provided with list of documentspublic MongoDataSource upsert(java.lang.String collection, io.vertx.core.json.JsonObject document, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>> resultHandler)
MongoDataSourceupsert in interface MongoDataSourcecollection - the collectiondocument - The document to insert or update.resultHandler - A handler to handle the AsnycResult which contains a String with the new id (insert), or
null (update).public MongoDataSource bulkInsert(java.lang.String collection, java.util.List<io.vertx.core.json.JsonObject> documents, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
MongoDataSourcebulkInsert in interface MongoDataSourcecollection - the collectiondocuments - A collection of resources to insert into the collection.resultHandler - A handler to handle the AsnycResult which contains the number of inserted documents.public MongoDataSource removeDocuments(java.lang.String collection, io.vertx.core.json.JsonObject query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
MongoDataSourceremoveDocuments in interface MongoDataSourcecollection - the collectionquery - A filter for the remove request.resultHandler - A handler to handle the AsnycResult which contains the number of deleted entries.public MongoDataSource dropCollection(java.lang.String collection, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
MongoDataSourcedropCollection in interface MongoDataSourcecollection - The collection.resultHandler - will be called when completepublic MongoDataSource createIndex(java.lang.String collection, Index index, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
MongoDataSourcecreateIndex in interface MongoDataSourcecollection - The collection.resultHandler - A handler which will be called when the index is created.public MongoDataSource listIndexes(java.lang.String collection, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonArray>> resultHandler)
MongoDataSourcelistIndexes in interface MongoDataSourcecollection - The collection.resultHandler - A handler which contains a JsonArray including indexes.public MongoDataSource deleteIndex(java.lang.String collection, java.lang.String name, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
MongoDataSourcedeleteIndex in interface MongoDataSourcecollection - The collection.name - The name of the index which should be deleted.resultHandler - A handler which will be called when the index is deleted.