rethinkdb-init icon indicating copy to clipboard operation
rethinkdb-init copied to clipboard

Compound indexes

Open ghost opened this issue 8 years ago • 2 comments

Do you have support for compound indexes?

// Create a compound secondary index based on the first_name and last_name attributes
r.table("users").indexCreate(
    "full_name", [r.row("last_name"), r.row("first_name")]
).run(conn, callback)

ghost avatar May 17 '17 10:05 ghost

Up !

Xstoudi avatar Sep 19 '17 14:09 Xstoudi

I had the same question. It seems to just work if you follow the documentation for indexFunction.

For example, this seems to work:


await r.init(dbOptions, [
    {
      name: 'users',
      indexes: [
        {
          indexFunction: [r.row('last_name'), r.row('first_name')],
          name: 'full_name'
        },
        'username',
        'someOtherIndex'
      ]
    }
  ]);

blakek avatar Oct 03 '17 16:10 blakek