I am trying to make a website which lists data in a table from a CouchDB database. I tried adding a view as seen below:
@View( name = "all", map = "function(doc) { if (doc.type == 'sofa' ) emit( [doc.sofaID,doc.timesofa], doc._id )}")
public List<TVreport> getAllTVreports() {
List<TVreport> couchresults = null;
try {
ViewQuery q = new ViewQuery().allDocs().includeDocs(true);
couchresults = sofadb.queryView(q, TVreport.class);
} catch (Exception e) {
System.err.println(e.getMessage());
}
return couchresults;
}
This results in no change to the order of the list. I need to be able to sort by both sofaID and timesofa which I made as unique keys. I am using Ektorp Java library.