SurrealDB
Run SurrealQL with bound variables on SurrealDB and read or write records. Typical uses: read a SurrealDB application's data, load rows into a table.
surreal pingsurreal collection_createsurreal collection_createsurreal putsurreal putsurreal insertsurreal insertsurreal getsurreal findsurreal findsurreal countsurreal countsurreal querysurreal querysurreal resultssurreal resultssurreal updatesurreal deletesurreal delete_wheresurreal collectionssurreal collection_infosurreal databasessurreal infosurreal requestsurreal requestsurreal collection_drop
surreal ping <config>
Description
Test the connection: {ok, version}
Test the connection: {ok, version}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
admin
surreal ping "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}"
mentdb
{"ok": true, "version": "surrealdb-2.3.7"}
surreal collection_create <config> <table>
Description
Define a table (DEFINE TABLE IF NOT EXISTS ... SCHEMALESS): {created}
Define a table (DEFINE TABLE IF NOT EXISTS ... SCHEMALESS): {created}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
admin
surreal collection_create "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer"
mentdb
{"created": "customer"}
surreal collection_create <config> <table> <json_options>
Description
Define a table with options: schemafull (false)
Define a table with options: schemafull (false)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_options: The options - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_options: The options - String - required
admin
surreal collection_create "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "invoice" "{\"schemafull\": true}"
mentdb
{"created": "invoice"}
surreal put <config> <table> <id> <json_doc>
Description
Create or replace a record by id (UPSERT ... CONTENT): the record
Create or replace a record by id (UPSERT ... CONTENT): the record
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
json_doc: The document as a JSON object - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
json_doc: The document as a JSON object - String - required
admin
surreal put "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "zoe" "{\"name\": \"Zoé\", \"city\": \"Paris\", \"age\": 31}"
mentdb
{"age": 31, "city": "Paris", "id": "customer:zoe", "name": "Zoé"}
a text id made of digits (fixed result: real SurrealDB 2.3.7)
admin
surreal put "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "⟨007⟩" "{\"name\": \"Bond\", \"city\": \"London\", \"age\": 40}"
mentdb
{"age": 40, "city": "London", "id": "customer:⟨007⟩", "name": "Bond"}
surreal put <config> <table> <id> <json_doc> <json_options>
Description
Put with options: merge (true: UPSERT ... MERGE, the other fields are kept)
Put with options: merge (true: UPSERT ... MERGE, the other fields are kept)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
json_doc: The document as a JSON object - String - required
json_options: The options - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
json_doc: The document as a JSON object - String - required
json_options: The options - String - required
admin
surreal put "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "zoe" "{\"age\": 32}" "{\"merge\": true}"
mentdb
{"age": 32, "city": "Paris", "id": "customer:zoe", "name": "Zoé"}
surreal insert <config> <table> <json_rows>
Description
Insert rows (INSERT INTO, batches of 1000); an id field gives the record id: {inserted, errors, ids}
Insert rows (INSERT INTO, batches of 1000); an id field gives the record id: {inserted, errors, ids}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_rows: The rows: a JSON array of objects (100000 at most) - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_rows: The rows: a JSON array of objects (100000 at most) - String - required
admin
surreal insert "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "[{\"id\": \"paul\", \"name\": \"Paul\", \"city\": \"Paris\", \"age\": 45}, {\"id\": 7, \"name\": \"Ana\", \"city\": \"Nice\", \"age\": 19}]"
mentdb
{"inserted": 2, "errors": [], "ids": ["customer:paul", "customer:7"]}
surreal insert <config> <table> <json_rows> <json_options>
Description
Insert with options: id_field (a field copied to id), ignore (INSERT IGNORE: existing records are kept), batch_size (1000)
Insert with options: id_field (a field copied to id), ignore (INSERT IGNORE: existing records are kept), batch_size (1000)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_rows: The rows: a JSON array of objects (100000 at most) - String - required
json_options: The options - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_rows: The rows: a JSON array of objects (100000 at most) - String - required
json_options: The options - String - required
admin
surreal insert "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "[{\"id\": \"paul\", \"name\": \"Paul bis\"}]" "{\"ignore\": true}"
mentdb
{"inserted": 0, "errors": [], "ids": []}
surreal get <config> <table> <id>
Description
A record as a JSON object; null if it does not exist
A record as a JSON object; null if it does not exist
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
admin
surreal get "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "zoe"
mentdb
{"age": 32, "city": "Paris", "id": "customer:zoe", "name": "Zoé"}
an integer id (fixed result: real SurrealDB 2.3.7)
admin
surreal get "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "7"
mentdb
{"age": 19, "city": "Nice", "id": "customer:7", "name": "Ana"}
a text id of digits (written by surreal put with ⟨007⟩) (fixed result: real SurrealDB 2.3.7)
admin
surreal get "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "⟨007⟩"
mentdb
{"age": 40, "city": "London", "id": "customer:⟨007⟩", "name": "Bond"}
no such record (fixed result: real SurrealDB 2.3.7)
admin
surreal get "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "nothing"
mentdb
null
surreal find <config> <table> <json_filter>
Description
The records matching a filter as rows (SELECT ... WHERE with bound variables, 1000 at most)
The records matching a filter as rows (SELECT ... WHERE with bound variables, 1000 at most)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
admin
surreal find "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "{\"city\": {\"$in\": [\"Paris\", \"Lyon\"]}}"
mentdb
[{"age": 45, "city": "Paris", "id": "customer:paul", "name": "Paul"}, {"age": 32, "city": "Paris", "id": "customer:zoe", "name": "Zoé"}]
surreal find <config> <table> <json_filter> <json_options>
Description
Find with options: Options: limit (1000, 100000 at most), skip, sort ({"age": -1} or [["age", "desc"]]), fields (an array of field names)
Find with options: Options: limit (1000, 100000 at most), skip, sort ({"age": -1} or [["age", "desc"]]), fields (an array of field names)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
json_options: The options - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
json_options: The options - String - required
admin
surreal find "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "{\"age\": {\"$gte\": 20}}" "{\"sort\": {\"age\": -1}, \"fields\": [\"name\", \"age\"]}"
mentdb
[{"age": 45, "name": "Paul"}, {"age": 40, "name": "Bond"}, {"age": 32, "name": "Zoé"}]
surreal count <config> <table>
Description
The number of records of a table (SELECT count() ... GROUP ALL)
The number of records of a table (SELECT count() ... GROUP ALL)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
admin
surreal count "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer"
mentdb
4
surreal count <config> <table> <json_filter>
Description
The number of records matching a filter
The number of records matching a filter
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
admin
surreal count "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "{\"city\": \"Paris\"}"
mentdb
2
surreal query <config> <surrealql>
Description
Run SurrealQL: the result of the last statement (rows for a SELECT); an error of any statement is thrown
Run SurrealQL: the result of the last statement (rows for a SELECT); an error of any statement is thrown
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
admin
surreal query "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "SELECT city, count() AS n, math::mean(age) AS mean_age FROM customer GROUP BY city ORDER BY city"
mentdb
[{"city": "London", "mean_age": 40, "n": 1}, {"city": "Nice", "mean_age": 19, "n": 1}, {"city": "Paris", "mean_age": 38.5, "n": 2}]
a value (fixed result: real SurrealDB 2.3.7)
admin
surreal query "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "RETURN 1 + 2"
mentdb
3
surreal query <config> <surrealql> <json_vars>
Description
SurrealQL with variables ($name)
SurrealQL with variables ($name)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
json_vars: The variables of the query as a JSON object, used as $name - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
json_vars: The variables of the query as a JSON object, used as $name - String - required
admin
surreal query "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "SELECT name, age FROM customer WHERE age >= $min ORDER BY age" "{\"min\": 30}"
mentdb
[{"age": 32, "name": "Zoé"}, {"age": 40, "name": "Bond"}, {"age": 45, "name": "Paul"}]
surreal results <config> <surrealql>
Description
Run several statements: [{statement, status, result or error}], an error stays in its place
Run several statements: [{statement, status, result or error}], an error stays in its place
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
admin
surreal results "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "LET $x = 5; THROW \"stop\"; RETURN $x * 2"
mentdb
[{"statement": 1, "status": "OK", "result": null}, {"statement": 2, "status": "ERR", "error": "An error occurred: stop"}, {"statement": 3, "status": "OK", "result": 10}]
surreal results <config> <surrealql> <json_vars>
Description
Several statements with variables
Several statements with variables
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
json_vars: The variables of the query as a JSON object, used as $name - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
surrealql: The SurrealQL statements - String - required
json_vars: The variables of the query as a JSON object, used as $name - String - required
admin
surreal results "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "RETURN $a; SELECT count() FROM customer GROUP ALL" "{\"a\": \"hello\"}"
mentdb
[{"statement": 1, "status": "OK", "result": "hello"}, {"statement": 2, "status": "OK", "result": [{"count": 4}]}]
surreal update <config> <table> <json_filter> <json_changes>
Description
Merge the changes into the matching records (UPDATE ... MERGE ... WHERE): {matched, modified}
Merge the changes into the matching records (UPDATE ... MERGE ... WHERE): {matched, modified}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
json_changes: The new values of top-level fields, like {"vip": true} - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
json_changes: The new values of top-level fields, like {"vip": true} - String - required
admin
surreal update "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "{\"city\": \"Paris\"}" "{\"vip\": true}"
mentdb
{"matched": 2, "modified": 2}
surreal delete <config> <table> <id>
Description
Delete a record: {deleted: 1}, or {deleted: 0}
Delete a record: {deleted: 1}, or {deleted: 0}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
id: The record id: a canonical integer (7) is an integer id, any other text a text id; ⟨...⟩ forces a text; table:id is accepted - String - required
admin
surreal delete "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "7"
mentdb
{"deleted": 1}
surreal delete_where <config> <table> <json_filter>
Description
Delete the records matching a filter: {deleted}
Delete the records matching a filter: {deleted}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
json_filter: The filter, the same for every NoSQL family: {"city": "Paris", "age": {"$gte": 18}}; operators $eq $ne $gt $gte $lt $lte $in $nin; the conditions are combined with AND - String - required
admin
surreal delete_where "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer" "{\"age\": {\"$gt\": 40}}"
mentdb
{"deleted": 1}
surreal collections <config>
Description
The tables of the database
The tables of the database
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
admin
surreal collections "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}"
mentdb
["customer", "invoice"]
surreal collection_info <config> <table>
Description
INFO FOR TABLE: events, fields, indexes
INFO FOR TABLE: events, fields, indexes
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
admin
surreal collection_info "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "customer"
mentdb
{"events": {}, "fields": {}, "indexes": {}, "lives": {}, "tables": {}}
surreal databases <config>
Description
The databases of the namespace (INFO FOR NS)
The databases of the namespace (INFO FOR NS)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
admin
surreal databases "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}"
mentdb
["crm"]
surreal info <config>
Description
INFO FOR DB: tables, functions, accesses, users...
INFO FOR DB: tables, functions, accesses, users...
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
admin
surreal info "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}"
mentdb
{"accesses": {}, "analyzers": {}, "apis": {}, "configs": {}, "functions": {}, "models": {}, "params": {}, "tables": {"customer": "DEFINE TABLE customer TYPE ANY SCHEMALESS PERMISSIONS NONE", "invoice": "DEFINE TABLE invoice TYPE NORMAL SCHEMAFULL PERMISSIONS NONE"}, "users": {}}
surreal request <config> <method> <path>
Description
Any request of the HTTP API: the answer (JSON or text)
Any request of the HTTP API: the answer (JSON or text)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
method: The HTTP method - String - required
path: The path from the root of the server, starting with / (encoded) - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
method: The HTTP method - String - required
path: The path from the root of the server, starting with / (encoded) - String - required
admin
surreal request "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "GET" "/version"
mentdb
surrealdb-2.3.7
surreal request <config> <method> <path> <body>
Description
Any request with a body (text/plain for /sql)
Any request with a body (text/plain for /sql)
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
method: The HTTP method - String - required
path: The path from the root of the server, starting with / (encoded) - String - required
body: The body - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
method: The HTTP method - String - required
path: The path from the root of the server, starting with / (encoded) - String - required
body: The body - String - required
admin
surreal request "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "POST" "/sql" "RETURN 40 + 2"
mentdb
[{"result": 42, "status": "OK", "time": "10.334µs"}]
surreal collection_drop <config> <table>
Description
Remove a table and its records (REMOVE TABLE IF EXISTS): {dropped}
Remove a table and its records (REMOVE TABLE IF EXISTS): {dropped}
Parameters
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
config: The SurrealDB configuration as JSON: url (http://127.0.0.1:8000), namespace and database (required), username and password (the name of a secret: secret set) of a root user, or of a namespace / database user with auth_namespace and auth_database, or token (or token: a JWT of SIGNIN), allow_plain (false), timeout_ms (30000), max_bytes (64 MB) - String - required
table: The table (the collection of SurrealDB): letters, digits and _ - String - required
admin
surreal collection_drop "{\"url\": \"http://127.0.0.1:8000\", \"namespace\": \"shop\", \"database\": \"crm\", \"username\": \"root\", \"password\": \"surreal_password\"}" "invoice"
mentdb
{"dropped": "invoice"}
