1

我有一个这样的对象:

Company {
  Enable bool
  Pro bool
  Type int
  Categories []int
}

那么,如何进行查询以检索 Enable=true、Categories 包含的所有对象,例如“1”并按 Pro 和 Type 排序。我有超过 200,000 条记录,所以我必须使用索引来提高效率。

我尝试使用这个:

r.db("test_main").table("companies").indexCreate("ListAll", function(comp) {
    return comp("Categories").map(function(cat) {
        return [ comp("Pro"), comp("CompType"), comp("Enabled"), cat  ];
    });
}, {multi: true})

r.db("test_main").table("companies").between([false, 0, true, 1],
  [r.maxval, r.maxval, true, 1], {index:"ListAll"}).orderBy({index:r.desc("ListAll")}).limit(100)

但类别不匹配。

4

0 回答 0