public interface MongoCollection<T>
Modifier and Type | Method and Description |
---|---|
MongoCollection<T> |
bulkInsert(java.util.Collection<T> resources,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Inserts many resources into the collection.
|
MongoCollection<T> |
count(io.vertx.core.json.JsonObject query,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Count matching entries in a collection.
|
MongoCollection<T> |
countAll(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Count all entries in a collection.
|
MongoCollection<T> |
createIndex(Index index,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
Creates an index.
|
MongoCollection<T> |
deleteIndex(java.lang.String name,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
Deletes an index.
|
MongoCollection<T> |
drop(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
Drop the collection.
|
MongoCollection<T> |
find(io.vertx.core.json.JsonObject query,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<T>>> resultHandler)
Finds matching entries in a collection.
|
MongoCollection<T> |
findAll(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<T>>> resultHandler)
Finds all entries in a collection.
|
java.lang.String |
getCollectionName() |
MongoCollection<T> |
listIndexes(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Index>>> resultHandler)
List all indexes.
|
MongoCollection<T> |
remove(io.vertx.core.json.JsonObject query,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Remove matching entries in a collection.
|
MongoCollection<T> |
remove(java.lang.String id,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
Removes the resource with the passed ID from the collection.
|
MongoCollection<T> |
upsert(T resource,
io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>> resultHandler)
Insert or update a resource into the collection.
|
java.lang.String getCollectionName()
MongoCollection<T> count(io.vertx.core.json.JsonObject query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
query
- A filter for the count request. For counting all entries in a collection use
countAll(Handler)
.resultHandler
- A handler to handle the AsnycResult which contains the number of matching entries.MongoCollection<T> countAll(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
resultHandler
- A handler to handle the AsnycResult which contains the number of all entries.MongoCollection<T> find(io.vertx.core.json.JsonObject query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<T>>> resultHandler)
query
- A filter for the find request. For finding all entries in a collection use
findAll(Handler)
.resultHandler
- A handler to handle the AsnycResult which contains a List with all matching entries.MongoCollection<T> findAll(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<T>>> resultHandler)
resultHandler
- A handler to handle the AsnycResult which contains a List with all entries.MongoCollection<T> upsert(T resource, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.String>> resultHandler)
resource
- The resource to insert or update.resultHandler
- A handler to handle the AsnycResult which contains a String with the new id (insert), or
null (update).MongoCollection<T> bulkInsert(java.util.Collection<T> resources, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
resources
- A collection of resources to insert into the collection.resultHandler
- A handler to handle the AsnycResult which contains the number of inserted resources.MongoCollection<T> remove(java.lang.String id, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
id
- The ID of the resource to delete.resultHandler
- A handler to handle the AsnycResult which contains the number of deleted entries.MongoCollection<T> remove(io.vertx.core.json.JsonObject query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler)
query
- A filter for the remove request.resultHandler
- A handler to handle the AsnycResult which contains the number of deleted entries.MongoCollection<T> drop(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
resultHandler
- A handler which will be called when complete.MongoCollection<T> listIndexes(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<Index>>> resultHandler)
resultHandler
- A handler which contains a list of indexes.MongoCollection<T> createIndex(Index index, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
index
- An Index object, that represents the index.resultHandler
- A handler which will be called when the index is created.MongoCollection<T> deleteIndex(java.lang.String name, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> resultHandler)
name
- The name of the index which should be deleted.resultHandler
- A handler which will be called when the index is deleted.