/** * Query all records by pager/sorter both * * @param pager * @param sorter * @return */ public static FindOptions toFull( final Pager pager, final Sorter sorter ) { final FindOptions options = new FindOptions(); Fn.safeNull(() -> { options.setLimit(pager.getSize()); options.setSkip(pager.getStart()); }, pager); Fn.safeNull(() -> options.setSort(sorter.toJson((mode) -> mode ? 1 : -1)), sorter); return options; } }
static Future<JsonArray> findWithOptions(final String collection, final JsonObject filter, final FindOptions options) { return Ux.thenGeneric(future -> CLIENT.findWithOptions(collection, filter, options, res -> { final JsonArray result = new JsonArray(); Observable.fromIterable(res.result()) .filter(Objects::nonNull) .subscribe(result::add); LOGGER.debug(Info.MONGO_FIND, collection, filter, options.toJson(), result); future.complete(result); })); }
public static Future<JsonArray> find(final String collection, final JsonObject filter) { return UxMongo.findWithOptions(collection, filter, new FindOptions()); } }
public static Future<JsonArray> find(final String collection, final JsonObject filter) { return UxMongo.findWithOptions(collection, filter, new FindOptions()); } }
/** * Query all records by pager/sorter both * * @param pager * @param sorter * @return */ public static FindOptions toFull( final Pager pager, final Sorter sorter ) { final FindOptions options = new FindOptions(); Fn.safeNull(() -> { options.setLimit(pager.getSize()); options.setSkip(pager.getStart()); }, pager); Fn.safeNull(() -> options.setSort(sorter.toJson((mode) -> mode ? 1 : -1)), sorter); return options; } }
public static io.vertx.ext.mongo.MongoClient findWithOptions(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.util.Map<String, Object>>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, options != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<io.vertx.core.json.JsonObject>>>() { public void handle(io.vertx.core.AsyncResult<java.util.List<io.vertx.core.json.JsonObject>> ar) { resultHandler.handle(ar.map(event -> event != null ? event.stream().map(elt -> io.vertx.core.impl.ConversionHelper.fromJsonObject(elt)).collect(java.util.stream.Collectors.toList()) : null)); } } : null)); return j_receiver; } public static io.vertx.core.streams.ReadStream<io.vertx.core.json.JsonObject> findBatchWithOptions(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> options) {
static Future<JsonArray> findWithOptions(final String collection, final JsonObject filter, final FindOptions options) { return Ux.thenGeneric(future -> CLIENT.findWithOptions(collection, filter, options, res -> { final JsonArray result = new JsonArray(); Observable.fromIterable(res.result()) .filter(Objects::nonNull) .subscribe(result::add); LOGGER.debug(Info.MONGO_FIND, collection, filter, options.toJson(), result); future.complete(result); })); }
public static io.vertx.ext.mongo.MongoService findWithOptions(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<java.util.Map<String, Object>>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, options != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.List<io.vertx.core.json.JsonObject>>>() { public void handle(io.vertx.core.AsyncResult<java.util.List<io.vertx.core.json.JsonObject>> ar) { resultHandler.handle(ar.map(event -> event != null ? event.stream().map(elt -> io.vertx.core.impl.ConversionHelper.fromJsonObject(elt)).collect(java.util.stream.Collectors.toList()) : null)); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoService findOne(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> fields, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.mongo.MongoService findOneAndDeleteWithOptions(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> findOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findOneAndDeleteWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, findOptions != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(findOptions)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoService count(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) {
public static io.vertx.core.streams.ReadStream<io.vertx.core.json.JsonObject> findBatchWithOptions(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> options) { return io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findBatchWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, options != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(options)) : null)); } public static io.vertx.ext.mongo.MongoClient findOne(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> fields, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.mongo.MongoClient findOneAndDeleteWithOptions(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> findOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findOneAndDeleteWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, findOptions != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(findOptions)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoClient count(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Long>> resultHandler) {
public static io.vertx.ext.mongo.MongoClient findOneAndUpdateWithOptions(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> update, java.util.Map<String, Object> findOptions, java.util.Map<String, Object> updateOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findOneAndUpdateWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, update != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(update) : null, findOptions != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(findOptions)) : null, updateOptions != null ? new io.vertx.ext.mongo.UpdateOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(updateOptions)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoClient findOneAndReplace(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> replace, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.mongo.MongoService findOneAndReplaceWithOptions(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> update, java.util.Map<String, Object> findOptions, java.util.Map<String, Object> updateOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findOneAndReplaceWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, update != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(update) : null, findOptions != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(findOptions)) : null, updateOptions != null ? new io.vertx.ext.mongo.UpdateOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(updateOptions)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoService findOneAndDelete(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.mongo.MongoService findOneAndUpdateWithOptions(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> update, java.util.Map<String, Object> findOptions, java.util.Map<String, Object> updateOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findOneAndUpdateWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, update != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(update) : null, findOptions != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(findOptions)) : null, updateOptions != null ? new io.vertx.ext.mongo.UpdateOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(updateOptions)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoService findOneAndReplace(io.vertx.ext.mongo.MongoService j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> replace, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
public static io.vertx.ext.mongo.MongoClient findOneAndReplaceWithOptions(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, java.util.Map<String, Object> replace, java.util.Map<String, Object> findOptions, java.util.Map<String, Object> updateOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) { io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.findOneAndReplaceWithOptions(collection, query != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(query) : null, replace != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(replace) : null, findOptions != null ? new io.vertx.ext.mongo.FindOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(findOptions)) : null, updateOptions != null ? new io.vertx.ext.mongo.UpdateOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(updateOptions)) : null, resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject>>() { public void handle(io.vertx.core.AsyncResult<io.vertx.core.json.JsonObject> ar) { resultHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromJsonObject(event))); } } : null)); return j_receiver; } public static io.vertx.ext.mongo.MongoClient findOneAndDelete(io.vertx.ext.mongo.MongoClient j_receiver, java.lang.String collection, java.util.Map<String, Object> query, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {