You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DEFINE TABLE category SCHEMALESS;
DEFINE FIELD name ON category TYPE string;
DEFINE TABLE product SCHEMALESS;
DEFINE FIELD name ON product TYPE string;
DEFINE FIELD price ON product TYPE float;
DEFINE FIELD qty ON product TYPE int;
DEFINE FIELD category ON product TYPE record <category>;
using Rust sdk i want to insert a new product in db. all my categories are already existing in db , issue is that when i try to save the product Surreal is expecting a record.
Error: Api(Query("There was a problem with the database: Found { name: 'Fruits' } for field category, with record product:12niu1utrnh0gdoha8yo, but expected a record category"))
i also tried touse surrealdb::sql::Thing; but not working either.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
in Surreal db i have 2 tables: category & product
using Rust sdk i want to insert a new product in db. all my categories are already existing in db , issue is that when i try to save the product Surreal is expecting a record.
here is simplified Rust code:
models:
function to create product with a category that already exists in db, example:
{
id: category:Fruits,
name: 'Fruits'
}
i also tried touse surrealdb::sql::Thing; but not working either.
Beta Was this translation helpful? Give feedback.
All reactions