Search code examples
javascriptnode.jsrethinkdb

Index `coin` was not found on table `test.users`


I'm using RethinkDB and i'm making a 'leaderboard' function. I keep getting that error every time i run the commands.

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

}).limit(10)

Before you say do i have 'coin' inserted, yes i do have it inserted


Solution

  • Add an index on the "coin" field

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

    Or use your orderby without index:

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