Cheat Sheet
Simulation
DEFINE NAMESPACE testns; USE ns testns; DEFINE DATABASE testdb; USE db testdb; -- create a company with an id of "surrealdb" -- while the cofounders are not yet created CREATE companies:surrealdb SET name = 'SurrealDB', cofounders = [users:tobie, users:jaime]; -- by querying the cofounders' name, they don't exists yet, but we made sure their id were linked SELECT cofounders.*.name from companies:surrealdb; -- now, create those users CREATE users:tobie SET name = 'Tobie', companies.name = 'SurrealDB', skills = ['Rust', 'Javascript']; CREATE users:jaime SET name = 'Jamie', companies.name = 'SurrealDB', skills = ['Go', 'Python']; -- after creating those accounts, when querying it again, it should show their names SELECT cofounders.*.name FROM companies:surrealdb;
Share
Run