首页 > 解决方案 > 在表“test.users”上找不到索引“硬币”

问题描述

我正在使用 RethinkDB,并且正在制作“排行榜”功能。每次运行命令时,我都会不断收到该错误。

`Index `coin` was not found on table `test.users` in:
r.table("users").orderBy({
    index: r.desc("coin")

}).limit(10)

在你说我是否插入了“硬币”之前,是的,我确实插入了它

标签: javascriptnode.jsrethinkdb

解决方案


在“硬币”字段上添加索引

r.table("users").indexCreate("coin")

或者使用没有索引的 orderby:

r.table("users").orderBy(r.desc("coin"))...

推荐阅读