How can I change primary key of RethinkDB after my rethinkdb feathers service is created?
I tried below code but it won't affect.
app.use('/messages', service({
id: 'user_id',
Model: db,
name: 'messages'
}));
Is there anything I missed?
How can I change primary key of RethinkDB after my rethinkdb feathers service is created?
I tried below code but it won't affect.
app.use('/messages', service({
id: 'user_id',
Model: db,
name: 'messages'
}));
Is there anything I missed?
When using a different primary key the RethinkDB database needs to be initialized with the same primaryKey
option. You can either do that manually or use service.init
as documented here:
// Initialize the `messages` table with `user_id` as the primary key
app.service('messages').init({
primaryKey: 'user_id'
}).then(() => {
// Use service here
});