rethinkdb-init
rethinkdb-init copied to clipboard
Compound indexes
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)
Up !
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'
]
}
]);