If I try to retrieve a list of documents from a Couchbase server via a view with the Java SDK I get an empty result list:
ViewResult result = dataManager.getBucket().query(ViewQuery.from("_design/dev_task", "byID"));
List<ViewRow> rows = result.allRows(); // rows is empty
However, in the web console the same view has a non-empty filtered result list. A retrieval by document ID, on the other hand, works flawlessly:
JsonDocument taskDocument = dataManager.getBucket().get("task1", JsonDocument.class);
// taskDocument contains the document for task1
The query was defined as:
function (doc, meta) {
if (typeof(doc.taskID) == "number") {
emit(doc.taskID, doc);
}
}
and has the following name:
What might I be doing wrong?