Find resources unique field that is not the primary key?
ranzbak opened this issue · 0 comments
tl;dr is it possible to subscribe to objects with another field than the private key?
I'm trying to connect an existing database model to the asynchronous websockets.
I tried the pkField setting in connect, like this:
client = dcrf.connect(`${ws}:${window.location.host}${path}`, {
pkField: "uuid",
});
But when I try to subscribe to an object I can still only refer to it by the primary key in the table, not uuid.
I would like to use UUID instead of private key in my subscriptions, as UUID are no sequences, and impossible to guess.
Also the rest of the application works with UUID as the unique identifier.
I tried the 'pkField' setting in the configuration block of the connection, but this didn't seem to make any difference.
I'm subscribing with the following code, this fails:
const prom = client.subscribe('user_node', '932895c1-573e-4552-8703-8a9ca9e958ef', (msg, action) => {
console.log("msg: ", msg, " action: ", action);
}
What does work is the pk, even though pkField is set to 'uuid':
const prom = client.subscribe('user_node', '1', (msg, action) => {
console.log("msg: ", msg, " action: ", action);
}