I'm trying to create a record in SurrealQL with a variable:
CREATE student:$name SET age = 38
but for some reason the syntax isn't allowed. Any idea why this is the case?
CREATE type::thing("student", $name) SET age 38
https://surrealdb.com/docs/surrealql/functions/type#thing covers this, but you can use a type function to create a record link, which in your case can be passed to CREATE.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.