JsonObject wrapper = new JsonObject();
wrapper.putString("collection", collection);
wrapper.putString("action", "find");
wrapper.putObject("matcher", new JsonObject());
final JsonArray result = new JsonArray();
eventBus.send(mongoAddress, wrapper, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
String status = reply.body().getString("status");
if (status != null) {
if ("ok".equalsIgnoreCase(status)) {
JsonArray itResult = reply.body().getArray("results");
for (Object o : itResult) {
JsonObject json = (JsonObject) o;
// clean mongodb specific fields
json.removeField("_id");
json.removeField("updatedAt");
result.add(json);
}
next.handle(result);
return;
}
if ("more-exist".equalsIgnoreCase(status)) {
JsonArray itResult = reply.body().getArray("results");
for (Object o : itResult) {
JsonObject json = (JsonObject) o;
// clean mongodb specific fields
json.removeField("_id");