0

我正在尝试创建一个网站,其中列出了 CouchDB 数据库中表中的数据。我尝试添加如下所示的视图:

    @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;
}

这不会改变列表的顺序。我需要能够按我制作为唯一键的 sofaID 和 timesofa 进行排序。我正在使用 Ektorp Java 库。

4

0 回答 0