I got the error:
ReqlLogicError: Expected type TABLE but found SINGLE_SELECTION
with the ReQL await
client.db.table('userData').get('249923459738632194').insert({money: money}).run();
.
Why does that happen, how can I fix it?
The table has a primary key of userid
.
The data entry is as listed below:
"equipped": "Rusted Sword",
"money": 0,
"user": "Facto#0001",
"userid": "249923459738632194",
"weapons": [
"Rusted Sword"
]
The money
variable is a math.random
function which came out as 9
.
Insert is for inserting new documents into a table. You have obtained a specific document using get() and then running insert against the document that returned. If you want to insert the document then remove the get. If you want to add the money field to the document then use update.
r.table(‘...’).get(‘...’).update({money:money})