I have setup a table with custom id
field as follows:
app.use('session', new Service({
Model: r,
db,
id: 'hash',
name: 'sessions',
}));
Then I create new entries with preset hash (id) field:
app.service('session').create({hash:'123456', ...})
And I get the above error.
I have managed to replace the following code in function create(data)
:
return this.table.insert(data).run().then(function (res) {
return Object.assign({
id: data.id ? data.id : res.generated_keys[0]
}, data);
});
with
const idField = this.id;
return this.table.insert(data).run().then(function (res) {
const result = Object.assign({}, data);
if (!data[idField]) result[idField] = res.generated_keys[0];
return result;
});
... and things appear to work.
However there are similar problems in patch
and update
.