diff --git a/_redirects b/_redirects index 3fa2043c4..45c7f7e36 100644 --- a/_redirects +++ b/_redirects @@ -1,2 +1,2 @@ -https://docs.surrealdb.com/docs/* https://surrealdb.com/docs/surrealdb/1.x/:splat 200 +https://docs.surrealdb.com/docs/* https://surrealdb.com/docs/surrealdb/:splat 200 https://docs.surrealdb.com/* https://surrealdb.com/docs/:splat 200 \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index c26e6f4dc..b70a93e53 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -24,7 +24,7 @@ const config = { versions: { "1.x": { label: '1.x', - path: '1.x', + path: '', }, }, editUrl: 'https://github.com/surrealdb/docs.surrealdb.com/edit/main/', diff --git a/src/components/SDK/list.mdx b/src/components/SDK/list.mdx index a2044687f..d50406b2f 100644 --- a/src/components/SDK/list.mdx +++ b/src/components/SDK/list.mdx @@ -7,7 +7,7 @@ import SDKBoxes from './SDKBoxes.mdx'; , icon: , icon: ` character you can type your SurrealQL query, followed by th surreal sql --endpoint http://localhost:8000 --username root --password root --namespace test --database test ``` -It is also possible to pipe a set of statements to a remote database. This functionality is only designed for submitting a small number of queries to the database server. For a large number of queries, use the [import command](/docs/surrealdb/1.x/cli/import). +It is also possible to pipe a set of statements to a remote database. This functionality is only designed for submitting a small number of queries to the database server. For a large number of queries, use the [import command](/docs/surrealdb/cli/import). ```bash cat myfile.surql | surreal sql --endpoint http://localhost:8000 --username root --password root --namespace test --database test diff --git a/versioned_docs/version-1.x/cli/start.mdx b/versioned_docs/version-1.x/cli/start.mdx index 841d35739..7bcdacd9b 100644 --- a/versioned_docs/version-1.x/cli/start.mdx +++ b/versioned_docs/version-1.x/cli/start.mdx @@ -10,7 +10,7 @@ description: The start command starts a SurrealDB server in memory, on disk, or The start command starts a SurrealDB server in memory, on disk, or in a distributed setup. :::note -__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/1.x/installation) — it should only take a second! +__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/installation) — it should only take a second! ::: ## Command options diff --git a/versioned_docs/version-1.x/cli/upgrade.mdx b/versioned_docs/version-1.x/cli/upgrade.mdx index b34642ece..9fd042b1f 100644 --- a/versioned_docs/version-1.x/cli/upgrade.mdx +++ b/versioned_docs/version-1.x/cli/upgrade.mdx @@ -10,7 +10,7 @@ description: The upgrade command upgrades SurrealDB to the latest version, night The upgrade command upgrades SurrealDB to the latest version, nightly or a specified version. :::note -__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/1.x/installation) — it should only take a second! +__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/installation) — it should only take a second! ::: ## Command options diff --git a/versioned_docs/version-1.x/cli/validate.mdx b/versioned_docs/version-1.x/cli/validate.mdx index af436764d..07c109d56 100644 --- a/versioned_docs/version-1.x/cli/validate.mdx +++ b/versioned_docs/version-1.x/cli/validate.mdx @@ -10,7 +10,7 @@ description: The validate command validates one or many SurrealQL language files The validate command validates one or many SurrealQL language files. :::note -__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/1.x/installation) — it should only take a second! +__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/installation) — it should only take a second! ::: ## Command options diff --git a/versioned_docs/version-1.x/cli/version.mdx b/versioned_docs/version-1.x/cli/version.mdx index 1fe7ec68b..ebdc8f8c7 100644 --- a/versioned_docs/version-1.x/cli/version.mdx +++ b/versioned_docs/version-1.x/cli/version.mdx @@ -10,7 +10,7 @@ description: The version command outputs the current version of the installed co The version command outputs the current version of the installed command-line tool, and the machine architecture. :::note -__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/1.x/installation) — it should only take a second! +__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/installation) — it should only take a second! ::: ## Example usage diff --git a/versioned_docs/version-1.x/deployment/index.mdx b/versioned_docs/version-1.x/deployment/index.mdx index fd9147876..9308ba8c6 100644 --- a/versioned_docs/version-1.x/deployment/index.mdx +++ b/versioned_docs/version-1.x/deployment/index.mdx @@ -18,7 +18,7 @@ Getting started with SurrealDB is intended to be quick and easy. All of SurrealD which is a stable version. There are a number of features and performance improvements being worked on before a production-ready release. -1. We now have a query planner that may identify the possibility of using indexes (unique and non-unique). It all depends on the complexity of the query. This is where the [EXPLAIN](/docs/surrealdb/1.x/surrealql/statements/select#the-explain-clause) clause (for [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/select) statements) is useful, as it tells if any index is being used. +1. We now have a query planner that may identify the possibility of using indexes (unique and non-unique). It all depends on the complexity of the query. This is where the [EXPLAIN](/docs/surrealdb/surrealql/statements/select#the-explain-clause) clause (for [`SELECT`](/docs/surrealdb/surrealql/statements/select) statements) is useful, as it tells if any index is being used. 2. Improvements to how data is managed before being serialised to disk, reducing the amount of data cloning and copying within the database processing runtime. These changes will improve the performance of writing to, and reading from, the underlying storage engine, and will have a significant impact on performance and query speed. diff --git a/versioned_docs/version-1.x/index.mdx b/versioned_docs/version-1.x/index.mdx index 782fba3dd..4452ac72c 100644 --- a/versioned_docs/version-1.x/index.mdx +++ b/versioned_docs/version-1.x/index.mdx @@ -31,9 +31,9 @@ import Version from '@site/src/components/Version'; }} /> -SurrealDB makes building and scaling realtime apps dramatically quicker and easier. Get started by [installing the server](/docs/surrealdb/1.x/installation), and jump into our [getting started guide](/docs/surrealdb/1.x/introduction/start) to learn how to insert and query data in SurrealDB in minutes. +SurrealDB makes building and scaling realtime apps dramatically quicker and easier. Get started by [installing the server](/docs/surrealdb/installation), and jump into our [getting started guide](/docs/surrealdb/introduction/start) to learn how to insert and query data in SurrealDB in minutes. -To quickly test out SurrealDB and [SurrealQL](/docs/surrealdb/1.x/surrealql) functionality, we've included [demo dataset](/docs/surrealdb/1.x/surrealql/demo) which you can download and [import ](/docs/surrealdb/1.x/cli/import)into your SurrealDB instance. +To quickly test out SurrealDB and [SurrealQL](/docs/surrealdb/surrealql) functionality, we've included [demo dataset](/docs/surrealdb/surrealql/demo) which you can download and [import ](/docs/surrealdb/cli/import)into your SurrealDB instance. The current stable version of SurrealDB is diff --git a/versioned_docs/version-1.x/installation/index.mdx b/versioned_docs/version-1.x/installation/index.mdx index d11de6ff6..7e6d64710 100644 --- a/versioned_docs/version-1.x/installation/index.mdx +++ b/versioned_docs/version-1.x/installation/index.mdx @@ -19,6 +19,6 @@ There are multiple ways to install SurrealDB, depending on your operating system You can install SurrealDB on the following operating systems: -- [macOS](/docs/surrealdb/1.x/installation/macos) -- [Windows](/docs/surrealdb/1.x/installation/windows) -- [Linux](/docs/surrealdb/1.x/installation/linux) \ No newline at end of file +- [macOS](/docs/surrealdb/installation/macos) +- [Windows](/docs/surrealdb/installation/windows) +- [Linux](/docs/surrealdb/installation/linux) \ No newline at end of file diff --git a/versioned_docs/version-1.x/installation/running/docker.mdx b/versioned_docs/version-1.x/installation/running/docker.mdx index 9069ba622..25e1ee934 100644 --- a/versioned_docs/version-1.x/installation/running/docker.mdx +++ b/versioned_docs/version-1.x/installation/running/docker.mdx @@ -24,7 +24,7 @@ Use this tutorial to run SurrealDB from within Docker. ## Running the SurrealDB server using Docker -To get started using Docker, you can use the `latest` tag. To start a server use the [`start`](/docs/surrealdb/1.x/cli/start) command. By default SurrealDB runs on port `8000`. To view all the available versions and tags, or to use a specific tag visit the [Docker Hub](https://hub.docker.com/r/surrealdb/surrealdb) page. +To get started using Docker, you can use the `latest` tag. To start a server use the [`start`](/docs/surrealdb/cli/start) command. By default SurrealDB runs on port `8000`. To view all the available versions and tags, or to use a specific tag visit the [Docker Hub](https://hub.docker.com/r/surrealdb/surrealdb) page. ```bash docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest start @@ -71,7 +71,7 @@ docker run --rm --pull always -p 80:8000 -v /local-dir:/container-dir surrealdb/ 2023-08-30T15:06:35.205827Z INFO surrealdb::net: Started web server on 0.0.0.0:8080 ``` -For details on the [`start`](/docs/surrealdb/1.x/cli/start) command, and all of the available configuration options and arguments, view the [`start command documentation`](/docs/surrealdb/1.x/cli/start). +For details on the [`start`](/docs/surrealdb/cli/start) command, and all of the available configuration options and arguments, view the [`start command documentation`](/docs/surrealdb/cli/start). ## Using the command-line tools within Docker The Docker container contains both the server, and the command line tools for importing, exporting, and querying a remote SurrealDB server. @@ -122,4 +122,4 @@ SUBCOMMANDS: ``` -For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/1.x/cli). \ No newline at end of file +For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/cli). \ No newline at end of file diff --git a/versioned_docs/version-1.x/installation/running/file.mdx b/versioned_docs/version-1.x/installation/running/file.mdx index a67374d05..2bbffe5bb 100644 --- a/versioned_docs/version-1.x/installation/running/file.mdx +++ b/versioned_docs/version-1.x/installation/running/file.mdx @@ -42,5 +42,5 @@ surreal start --user root --pass root --bind 0.0.0.0:8080 file:mydatabase.db 2023-08-30T15:06:35.205827Z INFO surrealdb::net: Started web server on 0.0.0.0:8080 ``` -For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/1.x/cli). +For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/cli). diff --git a/versioned_docs/version-1.x/installation/running/memory.mdx b/versioned_docs/version-1.x/installation/running/memory.mdx index 7762beb60..5b8ad5fe1 100644 --- a/versioned_docs/version-1.x/installation/running/memory.mdx +++ b/versioned_docs/version-1.x/installation/running/memory.mdx @@ -25,7 +25,7 @@ In order to keep SurrealDB secure, enable auth and configure your initial root-l surreal start --log trace --auth memory ``` -The previous command will bootstrap the server with the provided initial credentials, you can now remove those args and rely on [DEFINE USER](/docs/surrealdb/1.x/surrealql/statements/define/user) to change the password or create more users. +The previous command will bootstrap the server with the provided initial credentials, you can now remove those args and rely on [DEFINE USER](/docs/surrealdb/surrealql/statements/define/user) to change the password or create more users. ```bash surreal start --log trace --auth memory @@ -47,4 +47,4 @@ surreal start --user root --pass root --bind 0.0.0.0:8080 memory 2023-08-30T15:06:35.205123Z INFO surrealdb::node: Started node agent 2023-08-30T15:06:35.205827Z INFO surrealdb::net: Started web server on 0.0.0.0:8080 ``` -For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/1.x/cli). +For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/cli). diff --git a/versioned_docs/version-1.x/installation/running/tikv.mdx b/versioned_docs/version-1.x/installation/running/tikv.mdx index 6fe7f4e5c..ec1a53819 100644 --- a/versioned_docs/version-1.x/installation/running/tikv.mdx +++ b/versioned_docs/version-1.x/installation/running/tikv.mdx @@ -50,4 +50,4 @@ surreal start --user root --pass root --bind 0.0.0.0:8080 file:mydatabase.db 2023-08-30T15:06:35.205827Z INFO surrealdb::net: Started web server on 0.0.0.0:8080 ``` -For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/1.x/cli). +For details on the different commands available, visit the [CLI tool documentation](/docs/surrealdb/cli). diff --git a/versioned_docs/version-1.x/installation/windows.mdx b/versioned_docs/version-1.x/installation/windows.mdx index 89ce353e7..de3ce8472 100644 --- a/versioned_docs/version-1.x/installation/windows.mdx +++ b/versioned_docs/version-1.x/installation/windows.mdx @@ -21,7 +21,7 @@ import Version from '../../../src/components/Version'; # Install on Windows -Use this tutorial to install SurrealDB on Windows operating systems using the SurrealDB [install script](/docs/surrealdb/1.x/installation/windows#installing-surrealdb-using-the-install-script), or using third-party package managers like [Chocolatey](https://chocolatey.org/) or third-party like [Scoop](https://scoop.sh/). Both the SurrealDB Database Server and the SurrealDB Command Line Tool are packaged and distributed as a single executable file, which is easy to install, and easy to uninstall. +Use this tutorial to install SurrealDB on Windows operating systems using the SurrealDB [install script](/docs/surrealdb/installation/windows#installing-surrealdb-using-the-install-script), or using third-party package managers like [Chocolatey](https://chocolatey.org/) or third-party like [Scoop](https://scoop.sh/). Both the SurrealDB Database Server and the SurrealDB Command Line Tool are packaged and distributed as a single executable file, which is easy to install, and easy to uninstall. ## Installing SurrealDB using the install script diff --git a/versioned_docs/version-1.x/integration/http.mdx b/versioned_docs/version-1.x/integration/http.mdx index 4a6a4a288..659635f8c 100644 --- a/versioned_docs/version-1.x/integration/http.mdx +++ b/versioned_docs/version-1.x/integration/http.mdx @@ -20,7 +20,7 @@ You can access these endpoints via Postman. To do so, follow these steps: 4. If the endpoint requires any parameters or a body, make sure to include those in your request. :::note -__Note:__ Ensure that your URL is set correctly, if running locally, the URL should be `http://localhost:8000`.By default, the URL is set to local. Start your server using the Start command in the [CLI](/docs/surrealdb/1.x/cli/start), before querying the endpoints. +__Note:__ Ensure that your URL is set correctly, if running locally, the URL should be `http://localhost:8000`.By default, the URL is set to local. Start your server using the Start command in the [CLI](/docs/surrealdb/cli/start), before querying the endpoints. ::: You can use the HTTP endpoints to perform the following actions: @@ -366,7 +366,7 @@ curl -X POST -H "Accept: application/json" -d '{"user":"john.doe","pass":"123456 After you have defined the users permissions, you can use the `POST /signin` endpoint to sign in as a user. -Using the [user credentials](/docs/surrealdb/1.x/security/authentication#scope-users) created add the following to the request body: +Using the [user credentials](/docs/surrealdb/security/authentication#scope-users) created add the following to the request body: ```json { "ns": "test", @@ -451,10 +451,10 @@ curl -X POST -H "Accept: application/json" -d '{"ns":"test","db":"test","sc":"us ``` ### Example usage via Postman -Before you sigup a new [Scope user](/docs/surrealdb/1.x/security/authentication#scope-users), you must first [define a scope](/docs/surrealdb/1.x/surrealql/statements/define/scope) for the user. To do so, follow these steps: +Before you sigup a new [Scope user](/docs/surrealdb/security/authentication#scope-users), you must first [define a scope](/docs/surrealdb/surrealql/statements/define/scope) for the user. To do so, follow these steps: :::note -You can also define [System users](/docs/surrealdb/1.x/security/authentication#system-users) and [Define User](/docs/surrealdb/1.x/surrealql/statements/define/user) credentials using the [`POST /sql`](/docs/surrealdb/1.x/integration/http#sql) endpoint. +You can also define [System users](/docs/surrealdb/security/authentication#system-users) and [Define User](/docs/surrealdb/surrealql/statements/define/user) credentials using the [`POST /sql`](/docs/surrealdb/integration/http#sql) endpoint. ::: 1. Navigate to the `POST /sql` endpoint in Postman. diff --git a/versioned_docs/version-1.x/introduction/concepts.mdx b/versioned_docs/version-1.x/introduction/concepts.mdx index 4afbc9b7d..a1c8b9bce 100644 --- a/versioned_docs/version-1.x/introduction/concepts.mdx +++ b/versioned_docs/version-1.x/introduction/concepts.mdx @@ -13,19 +13,19 @@ This page aims to give details about some of the core concepts of SurrealDB, inc SurrealDB can be used either as a traditional database platform, with backend languages and frameworks including Golang, Python, Rust, C, Java, .Net, Node.js, and PHP. Alternatively, you can use SurrealDB as a complete backend platform, connecting directly to it from frontend languages and frameworks including JavaScript, [WebAssembly](https://webassembly.org/), [React.js](https://react.dev/), [Next.js](https://nextjs.org/), and [Ember.js](https://emberjs.com/). In this mode, permissions can be defined on a table, record, and field level, allow for granular data access patterns for multiple different types of users. ## Relational, document, or graph -SurrealDB is, at its core, a document database. Each record is stored on an underlying key-value store storage engine, with the ability to store arbitrary arrays, objects, and many other types of data. However, SurrealDB isn't just a document database. Because of the way that SurrealDB handles Record IDs and the fetching of individual records from the underlying key-value storage engine, it can be used to store time-series ordered data, and highly-connected graph data. With the addition of an SQL-like query language (named [SurrealQL](/docs/surrealdb/1.x/surrealql)), it is easy to create, update, and read data from across the database. +SurrealDB is, at its core, a document database. Each record is stored on an underlying key-value store storage engine, with the ability to store arbitrary arrays, objects, and many other types of data. However, SurrealDB isn't just a document database. Because of the way that SurrealDB handles Record IDs and the fetching of individual records from the underlying key-value storage engine, it can be used to store time-series ordered data, and highly-connected graph data. With the addition of an SQL-like query language (named [SurrealQL](/docs/surrealdb/surrealql)), it is easy to create, update, and read data from across the database. ## Single-node or distributed -SurrealDB is designed to be run in many different ways, and environments. Due to the [separation of the storage and compute layers](/docs/surrealdb/1.x/introduction/architecture), SurrealDB can be run in embedded mode, as a vertically-scalable, single-node database server, or as a horizontally-scalable, multi-node, distributed cluster. In embedded mode, SurrealDB can be run with an in-memory storage engine, in a web browser it can persist data using [IndexedDB](https://web.dev/indexeddb/), or it can persist data using the file-based [RocksDB](https://rocksdb.org/) storage engine. As a database server, SurrealDB can currently be configured to store data using [RocksDB](https://rocksdb.org/), [TiKV](https://tikv.org/), or [FoundationDB](https://www.foundationdb.org/). +SurrealDB is designed to be run in many different ways, and environments. Due to the [separation of the storage and compute layers](/docs/surrealdb/introduction/architecture), SurrealDB can be run in embedded mode, as a vertically-scalable, single-node database server, or as a horizontally-scalable, multi-node, distributed cluster. In embedded mode, SurrealDB can be run with an in-memory storage engine, in a web browser it can persist data using [IndexedDB](https://web.dev/indexeddb/), or it can persist data using the file-based [RocksDB](https://rocksdb.org/) storage engine. As a database server, SurrealDB can currently be configured to store data using [RocksDB](https://rocksdb.org/), [TiKV](https://tikv.org/), or [FoundationDB](https://www.foundationdb.org/). ## System structure -SurrealDB works similarly to other traditional relational databases, and document databases, with a few slight differences. SurrealDB is designed and developed to be a multi-tenant database platform with a high-level [`namespace`](/docs/surrealdb/1.x/surrealql/statements/define/namespace) layer designed as a separation for each organisations, department, or development team. There is no limit to the number of namespaces on SurrealDB. Below this, the [`databases`](/docs/surrealdb/1.x/surrealql/statements/define/database) layer is similar to databases in other database management systems. There is no limit to the number of databases on each namespace. Within each database, data can be stored within [`table`](/docs/surrealdb/1.x/surrealql/statements/define/table) definitions, otherwise known as collections in other database management systems. In SurrealDB each row or document is called a [`records`](/docs/surrealdb/1.x/surrealql/datamodel/ids) and columns are called [`fields`](/docs/surrealdb/1.x/surrealql/statements/define/field). While you can [`define`](/docs/surrealdb/1.x/surrealql/statements/define): +SurrealDB works similarly to other traditional relational databases, and document databases, with a few slight differences. SurrealDB is designed and developed to be a multi-tenant database platform with a high-level [`namespace`](/docs/surrealdb/surrealql/statements/define/namespace) layer designed as a separation for each organisations, department, or development team. There is no limit to the number of namespaces on SurrealDB. Below this, the [`databases`](/docs/surrealdb/surrealql/statements/define/database) layer is similar to databases in other database management systems. There is no limit to the number of databases on each namespace. Within each database, data can be stored within [`table`](/docs/surrealdb/surrealql/statements/define/table) definitions, otherwise known as collections in other database management systems. In SurrealDB each row or document is called a [`records`](/docs/surrealdb/surrealql/datamodel/ids) and columns are called [`fields`](/docs/surrealdb/surrealql/statements/define/field). While you can [`define`](/docs/surrealdb/surrealql/statements/define): -- [`namespace`](/docs/surrealdb/1.x/surrealql/statements/define/namespace) -- [`databases`](/docs/surrealdb/1.x/surrealql/statements/define/database) -- [`table`](/docs/surrealdb/1.x/surrealql/statements/define/table) -- [`fields`](/docs/surrealdb/1.x/surrealql/statements/define/field) +- [`namespace`](/docs/surrealdb/surrealql/statements/define/namespace) +- [`databases`](/docs/surrealdb/surrealql/statements/define/database) +- [`table`](/docs/surrealdb/surrealql/statements/define/table) +- [`fields`](/docs/surrealdb/surrealql/statements/define/field) -You cannot define [`records`](/docs/surrealdb/1.x/surrealql/datamodel/ids), you can only [create](/docs/surrealdb/1.x/surrealql/statements/create), read, [update](/docs/surrealdb/1.x/surrealql/statements/update) and [delete](/docs/surrealdb/1.x/surrealql/statements/delete) them. +You cannot define [`records`](/docs/surrealdb/surrealql/datamodel/ids), you can only [create](/docs/surrealdb/surrealql/statements/create), read, [update](/docs/surrealdb/surrealql/statements/update) and [delete](/docs/surrealdb/surrealql/statements/delete) them. Multiple authentication `scope` definitions can be defined on each `database`, allowing for custom authentication across tables, records, and fields. diff --git a/versioned_docs/version-1.x/introduction/mongo.mdx b/versioned_docs/version-1.x/introduction/mongo.mdx index 24122f90c..16ff665a7 100644 --- a/versioned_docs/version-1.x/introduction/mongo.mdx +++ b/versioned_docs/version-1.x/introduction/mongo.mdx @@ -28,7 +28,7 @@ As a multi-model database, SurrealDB offers a lot of flexibility. Our SQL-like q ## Concepts mapping -For more in-depth explanations of SurrealDB concepts, see the [concepts page](/docs/surrealdb/1.x/introduction/concepts). +For more in-depth explanations of SurrealDB concepts, see the [concepts page](/docs/surrealdb/introduction/concepts). @@ -111,9 +111,9 @@ Let's get you up to speed with SurrealQL syntax with some CRUD examples. ### Create -As MongoDB is schemaless, only the SurrealQL schemaless approach is shown below. For a schemafull option see the [define table](/docs/surrealdb/1.x/surrealql/statements/define/table) page. +As MongoDB is schemaless, only the SurrealQL schemaless approach is shown below. For a schemafull option see the [define table](/docs/surrealdb/surrealql/statements/define/table) page. -For more SurrealQL examples, see the [create](/docs/surrealdb/1.x/surrealql/statements/create) and [insert](/docs/surrealdb/1.x/surrealql/statements/insert) pages. +For more SurrealQL examples, see the [create](/docs/surrealdb/surrealql/statements/create) and [insert](/docs/surrealdb/surrealql/statements/insert) pages.
@@ -152,7 +152,7 @@ For more SurrealQL examples, see the [create](/docs/surrealdb/1.x/surrealql/stat ### Read -For more SurrealQL examples, see the [select](/docs/surrealdb/1.x/surrealql/statements/select), [live select](/docs/surrealdb/1.x/surrealql/statements/live) and [return](https://surrealdb.com/docs/surrealql/statements/return) pages. +For more SurrealQL examples, see the [select](/docs/surrealdb/surrealql/statements/select), [live select](/docs/surrealdb/surrealql/statements/live) and [return](https://surrealdb.com/docs/surrealql/statements/return) pages.
@@ -239,7 +239,7 @@ For more SurrealQL examples, see the [select](/docs/surrealdb/1.x/surrealql/stat ### Update -For more SurrealQL examples, see the [update](/docs/surrealdb/1.x/surrealql/statements/update) page. +For more SurrealQL examples, see the [update](/docs/surrealdb/surrealql/statements/update) page.
@@ -270,7 +270,7 @@ For more SurrealQL examples, see the [update](/docs/surrealdb/1.x/surrealql/stat ### Delete -For more SurrealQL examples, see the [delete](/docs/surrealdb/1.x/surrealql/statements/delete) and [remove](/docs/surrealdb/1.x/surrealql/statements/remove) pages. +For more SurrealQL examples, see the [delete](/docs/surrealdb/surrealql/statements/delete) and [remove](/docs/surrealdb/surrealql/statements/remove) pages.
diff --git a/versioned_docs/version-1.x/introduction/neo4j.mdx b/versioned_docs/version-1.x/introduction/neo4j.mdx index 52fc64c40..2edcd575b 100644 --- a/versioned_docs/version-1.x/introduction/neo4j.mdx +++ b/versioned_docs/version-1.x/introduction/neo4j.mdx @@ -28,7 +28,7 @@ As a multi-model database, SurrealDB offers a lot of flexibility. Our SQL-like q ## Concepts mapping -For more in-depth explanations of SurrealDB concepts, see the [concepts page](/docs/surrealdb/1.x/introduction/concepts). +For more in-depth explanations of SurrealDB concepts, see the [concepts page](/docs/surrealdb/introduction/concepts).
@@ -111,9 +111,9 @@ Let's get you up to speed with SurrealQL syntax with some CRUD examples. ### Create -As Neo4j is schemafull, only the SurrealQL schemafull approach is shown below. For a schemafull option see the [define table](/docs/surrealdb/1.x/surrealql/statements/define/table) page. +As Neo4j is schemafull, only the SurrealQL schemafull approach is shown below. For a schemafull option see the [define table](/docs/surrealdb/surrealql/statements/define/table) page. -For more SurrealQL examples, see the [create](/docs/surrealdb/1.x/surrealql/statements/create), [insert](/docs/surrealdb/1.x/surrealql/statements/insert) and [relate](/docs/surrealdb/1.x/surrealql/statements/relate) pages. +For more SurrealQL examples, see the [create](/docs/surrealdb/surrealql/statements/create), [insert](/docs/surrealdb/surrealql/statements/insert) and [relate](/docs/surrealdb/surrealql/statements/relate) pages.
@@ -152,7 +152,7 @@ For more SurrealQL examples, see the [create](/docs/surrealdb/1.x/surrealql/stat ### Read -For more SurrealQL examples, see the [select](/docs/surrealdb/1.x/surrealql/statements/select), [live select](/docs/surrealdb/1.x/surrealql/statements/live) and [return](https://surrealdb.com/docs/surrealql/statements/return) pages. +For more SurrealQL examples, see the [select](/docs/surrealdb/surrealql/statements/select), [live select](/docs/surrealdb/surrealql/statements/live) and [return](https://surrealdb.com/docs/surrealql/statements/return) pages.
@@ -239,7 +239,7 @@ For more SurrealQL examples, see the [select](/docs/surrealdb/1.x/surrealql/stat ### Update -For more SurrealQL examples, see the [update](/docs/surrealdb/1.x/surrealql/statements/update) page. +For more SurrealQL examples, see the [update](/docs/surrealdb/surrealql/statements/update) page.
@@ -278,7 +278,7 @@ For more SurrealQL examples, see the [update](/docs/surrealdb/1.x/surrealql/stat ### Delete -For more SurrealQL examples, see the [delete](/docs/surrealdb/1.x/surrealql/statements/delete) and [remove](/docs/surrealdb/1.x/surrealql/statements/remove) pages. +For more SurrealQL examples, see the [delete](/docs/surrealdb/surrealql/statements/delete) and [remove](/docs/surrealdb/surrealql/statements/remove) pages.
diff --git a/versioned_docs/version-1.x/introduction/sql.mdx b/versioned_docs/version-1.x/introduction/sql.mdx index cf47b5026..e3b52adcb 100644 --- a/versioned_docs/version-1.x/introduction/sql.mdx +++ b/versioned_docs/version-1.x/introduction/sql.mdx @@ -15,7 +15,7 @@ As a multi-model database, SurrealDB offers a lot of flexibility. Our SQL-like q ## Concepts mapping -For more in-depth explanations of SurrealDB concepts, see the [concepts page](/docs/surrealdb/1.x/introduction/concepts). +For more in-depth explanations of SurrealDB concepts, see the [concepts page](/docs/surrealdb/introduction/concepts).
@@ -98,9 +98,9 @@ Let's get you up to speed with SurrealQL syntax with some CRUD examples. ### Create -As relational databases are schemafull, only the SurrealQL schemafull approach is shown below. For a schemafull option see the [define table](/docs/surrealdb/1.x/surrealql/statements/define/table) page. +As relational databases are schemafull, only the SurrealQL schemafull approach is shown below. For a schemafull option see the [define table](/docs/surrealdb/surrealql/statements/define/table) page. -For more SurrealQL examples, see the [create](/docs/surrealdb/1.x/surrealql/statements/create) and [insert](/docs/surrealdb/1.x/surrealql/statements/insert) pages. +For more SurrealQL examples, see the [create](/docs/surrealdb/surrealql/statements/create) and [insert](/docs/surrealdb/surrealql/statements/insert) pages.
@@ -140,7 +140,7 @@ For more SurrealQL examples, see the [create](/docs/surrealdb/1.x/surrealql/stat ### Read -For more SurrealQL examples, see the [select](/docs/surrealdb/1.x/surrealql/statements/select), [live select](/docs/surrealdb/1.x/surrealql/statements/live) and [return](/docs/surrealdb/1.x/surrealql/statements/return) pages. +For more SurrealQL examples, see the [select](/docs/surrealdb/surrealql/statements/select), [live select](/docs/surrealdb/surrealql/statements/live) and [return](/docs/surrealdb/surrealql/statements/return) pages. | SQL | SurrealQL | |----------------------------------------------------------------------------------------------|------------------------------------------------------| @@ -232,7 +232,7 @@ For more SurrealQL examples, see the [select](/docs/surrealdb/1.x/surrealql/stat ### Update -For more SurrealQL examples, see the [update](/docs/surrealdb/1.x/surrealql/statements/update) page. +For more SurrealQL examples, see the [update](/docs/surrealdb/surrealql/statements/update) page.
@@ -272,7 +272,7 @@ For more SurrealQL examples, see the [update](/docs/surrealdb/1.x/surrealql/stat ### Delete -For more SurrealQL examples, see the [delete](/docs/surrealdb/1.x/surrealql/statements/delete) and [remove](/docs/surrealdb/1.x/surrealql/statements/remove) pages. +For more SurrealQL examples, see the [delete](/docs/surrealdb/surrealql/statements/delete) and [remove](/docs/surrealdb/surrealql/statements/remove) pages.
diff --git a/versioned_docs/version-1.x/introduction/start.mdx b/versioned_docs/version-1.x/introduction/start.mdx index f236fc84a..512d92597 100644 --- a/versioned_docs/version-1.x/introduction/start.mdx +++ b/versioned_docs/version-1.x/introduction/start.mdx @@ -12,7 +12,7 @@ In this guide, we will walk you through installing SurrealDB on your machine, de :::note -__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/1.x/installation) — it should only take a second! +__BEFORE YOU START :__ Make sure you’ve [installed SurrealDB](/docs/surrealdb/installation) — it should only take a second! ::: @@ -59,9 +59,9 @@ Password: 'root', ``` > *Note*: Surrealist is a third-party web-based SurrealQL client that allows you to run queries against your SurrealDB, built and maintained by StarlaneStudios! -### [`CREATE`](/docs/surrealdb/1.x/surrealql/statements/create) +### [`CREATE`](/docs/surrealdb/surrealql/statements/create) -The [create statement](/docs/surrealdb/1.x/surrealql/statements/create) is used to add records to the database. +The [create statement](/docs/surrealdb/surrealql/statements/create) is used to add records to the database. ```surql CREATE account SET @@ -98,9 +98,9 @@ CREATE article SET ; ``` -### Querying data with [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/select) +### Querying data with [`SELECT`](/docs/surrealdb/surrealql/statements/select) -The querying functionality in SurrealDB works similarly to a traditional SQL, but with many of the added benefits of NoSQL query languages. To retrieve data, we will use a [`SELECT` statement](/docs/surrealdb/1.x/surrealql/statements/select). You can query all the articles in your records and this will also return the record links. +The querying functionality in SurrealDB works similarly to a traditional SQL, but with many of the added benefits of NoSQL query languages. To retrieve data, we will use a [`SELECT` statement](/docs/surrealdb/surrealql/statements/select). You can query all the articles in your records and this will also return the record links. ```surql SELECT * FROM article; @@ -116,9 +116,9 @@ Also, instead of pulling data from multiple tables and merging that data togethe SELECT * FROM article WHERE author.age < 30 FETCH author, account; ``` -### [`UPDATE`](/docs/surrealdb/1.x/surrealql/statements/update) +### [`UPDATE`](/docs/surrealdb/surrealql/statements/update) -Similar to [UPDATE](/docs/surrealdb/1.x/surrealql/statements/update) in SQL you can also update specific IDs, for example say you wanted to update the first name of the author you can do so: +Similar to [UPDATE](/docs/surrealdb/surrealql/statements/update) in SQL you can also update specific IDs, for example say you wanted to update the first name of the author you can do so: ```surql UPDATE author:john SET name.first = 'David', name.full = string::join(' ', name.first, name.last); @@ -132,15 +132,15 @@ You can also update specific fields: UPDATE author:john SET admin = false WHERE name.last = 'Adams'; ``` -### [`DELETE`](/docs/surrealdb/1.x/surrealql/statements/delete) +### [`DELETE`](/docs/surrealdb/surrealql/statements/delete) -You can also delete specific records from the recordID `DELETE author:john` with the [DELETE statement](/docs/surrealdb/1.x/surrealql/statements/delete) or, you could delete a record with specific conditions: +You can also delete specific records from the recordID `DELETE author:john` with the [DELETE statement](/docs/surrealdb/surrealql/statements/delete) or, you could delete a record with specific conditions: ```surql DELETE article WHERE author.name.first = 'David'; ``` -### [`REMOVE`](/docs/surrealdb/1.x/surrealql/statements/remove) +### [`REMOVE`](/docs/surrealdb/surrealql/statements/remove) You can also remove a specific table using the `REMOVE TABLE`: diff --git a/versioned_docs/version-1.x/reference-guide/full-text-search.mdx b/versioned_docs/version-1.x/reference-guide/full-text-search.mdx index fdefeb729..fdc9114d1 100644 --- a/versioned_docs/version-1.x/reference-guide/full-text-search.mdx +++ b/versioned_docs/version-1.x/reference-guide/full-text-search.mdx @@ -20,13 +20,13 @@ We also use different search functions to highlight keywords and improve their r ## Analyzers -[Analyzers](/docs/surrealdb/1.x/surrealql/statements/define/analyzer) are configurations that use tokenizers or filters to prepare text data for searching. +[Analyzers](/docs/surrealdb/surrealql/statements/define/analyzer) are configurations that use tokenizers or filters to prepare text data for searching. They are foundational to how text is processed in Full-Text Search. It is defined by its name, a set of tokenizers, and a collection of filters. ## Tokenizers -[Tokenizers](/docs/surrealdb/1.x/surrealql/statements/define/analyzer#tokenizers) break down text into manageable tokens based on specified rules like spaces or punctuation. +[Tokenizers](/docs/surrealdb/surrealql/statements/define/analyzer#tokenizers) break down text into manageable tokens based on specified rules like spaces or punctuation. If we tokenize the sentence '*Getting started with SurrealDB*' based on space, it would be broken down into tokens: Getting, started, with, SurrealDB. ```surql @@ -37,7 +37,7 @@ DEFINE ANALYZER space_tokenizer TOKENIZERS blank; ## Filters -[Filters](/docs/surrealdb/1.x/surrealql/statements/define/analyzer#filters) process tokens for further refinement, such as converting to lowercase, removing special characters or breaking down tokens into useful prefixes to prepare for more effective searching. +[Filters](/docs/surrealdb/surrealql/statements/define/analyzer#filters) process tokens for further refinement, such as converting to lowercase, removing special characters or breaking down tokens into useful prefixes to prepare for more effective searching. ```surql -- Combining tokenizers and filters into a custom analyzer @@ -47,7 +47,7 @@ DEFINE ANALYZER custom_analyzer TOKENIZERS blank FILTERS lowercase, snowball(eng ## Define a Full-Text Index -To make a text field searchable, you need to set up a [full-text index](/docs/surrealdb/1.x/surrealql/statements/define/indexes/) on it by using the 'search' keyword. This step is necessary to search through the text easily. +To make a text field searchable, you need to set up a [full-text index](/docs/surrealdb/surrealql/statements/define/indexes/) on it by using the 'search' keyword. This step is necessary to search through the text easily. Depending on the use case, each field can be associated with a different analyser. @@ -59,7 +59,7 @@ DEFINE INDEX book_content ON book FIELDS content SEARCH ANALYZER custom_analyzer ## The MATCHES Operator -The [MATCHES](/docs/surrealdb/1.x/surrealql/operators#matches)  operator (@@) is used in queries to find documents that contain the given keywords based on the full-text indexes. +The [MATCHES](/docs/surrealdb/surrealql/operators#matches)  operator (@@) is used in queries to find documents that contain the given keywords based on the full-text indexes. ```surql -- Using the MATCHES (@@) operator in a query @@ -69,7 +69,7 @@ SELECT * FROM book WHERE content @@ 'tools'; ## Highlighting -The [`search::highlight`](/docs/surrealdb/1.x/surrealql/functions/search#searchhighlight) highlights the matching keywords for the predicate reference number. +The [`search::highlight`](/docs/surrealdb/surrealql/functions/search#searchhighlight) highlights the matching keywords for the predicate reference number. ```surql -- Using search::highlight('', '', content) to highlight search terms @@ -77,7 +77,7 @@ SELECT title, search::highlight('', '', content) AS highlighted_content FROM book WHERE content @@ 'Linux'; ``` -The [`search::offsets`](/docs/surrealdb/1.x/surrealql/functions/search#searchoffsets) returns the position of the matching keywords for the predicate reference number. +The [`search::offsets`](/docs/surrealdb/surrealql/functions/search#searchoffsets) returns the position of the matching keywords for the predicate reference number. ```surql SELECT title, search::offsets(1) AS title_offsets @@ -86,7 +86,7 @@ FROM book WHERE title @1@ 'linux'; ## Scoring and Ranking Search Results -The [`search::score`](/docs/surrealdb/1.x/surrealql/functions/search#searchscore) helps with scoring and ranking the search results based on their relevance to the search terms. +The [`search::score`](/docs/surrealdb/surrealql/functions/search#searchscore) helps with scoring and ranking the search results based on their relevance to the search terms. The relevance score is a decimal number typically ranging from 0 to 1, where a score closer to 1 indicates a higher relevance of the search result to the query terms, and a score closer to 0 indicates lower relevance. This score helps in sorting or filtering results based on how closely they match the user's search intent diff --git a/versioned_docs/version-1.x/reference-guide/index.mdx b/versioned_docs/version-1.x/reference-guide/index.mdx index 0c74f64f2..f6f1d029b 100644 --- a/versioned_docs/version-1.x/reference-guide/index.mdx +++ b/versioned_docs/version-1.x/reference-guide/index.mdx @@ -15,7 +15,7 @@ The purpose of this section is to help you connect the dots between different co It will help you understand how different features and concepts are related to each other and how you can use them together to build powerful applications. -If you are new to SurrealDB, we recommend that you start with the [Getting Started](/docs/surrealdb/1.x/introduction/start) section of the documentation or the [SurrealQL](/docs/surrealdb/1.x/surrealql). +If you are new to SurrealDB, we recommend that you start with the [Getting Started](/docs/surrealdb/introduction/start) section of the documentation or the [SurrealQL](/docs/surrealdb/surrealql). This section will provide you with a solid foundation of the core concepts and features of SurrealDB. @@ -27,4 +27,4 @@ These guides will help you dig deeper into some of the core concepts and feature To get started, select a guide from the sidebar or use the search functionality to find a specific topic of interest. -- [Full-Text Search](/docs/surrealdb/1.x/reference-guide/full-text-search) \ No newline at end of file +- [Full-Text Search](/docs/surrealdb/reference-guide/full-text-search) \ No newline at end of file diff --git a/versioned_docs/version-1.x/security/authentication.mdx b/versioned_docs/version-1.x/security/authentication.mdx index b7042d42b..8f6c72dca 100644 --- a/versioned_docs/version-1.x/security/authentication.mdx +++ b/versioned_docs/version-1.x/security/authentication.mdx @@ -9,18 +9,18 @@ description: There are multiple forms of authentication built into SurrealDB, su There are multiple forms of authentication built into SurrealDB, supporting different use cases: -- [System users](/docs/surrealdb/1.x/security/authentication#system-users): Created by the SurrealDB administrator and used for managing and consuming the database -- [Scope users](/docs/surrealdb/1.x/security/authentication#scope-users): Used for consuming the database, and they allow custom signup, signin and permissions logic +- [System users](/docs/surrealdb/security/authentication#system-users): Created by the SurrealDB administrator and used for managing and consuming the database +- [Scope users](/docs/surrealdb/security/authentication#scope-users): Used for consuming the database, and they allow custom signup, signin and permissions logic ## System users System users is the term we use to describe users defined directly on SurrealDB by the administrator. Same concept as any other database. -Users may belong to different levels (root, namespace or database) and have different roles assigned to limit what they can do to the system. Users are defined with the [DEFINE USER](/docs/surrealdb/1.x/surrealql/statements/define/user) statement. +Users may belong to different levels (root, namespace or database) and have different roles assigned to limit what they can do to the system. Users are defined with the [DEFINE USER](/docs/surrealdb/surrealql/statements/define/user) statement. SurrealDB implements RBAC (Role Based Access Control) to define what a user can do. Each user is assigned one or more roles (currently limited to the built-in `OWNER`, `EDITOR` and `VIEWER` roles). -Go to [DEFINE USER](/docs/surrealdb/1.x/surrealql/statements/define/user) for more information. +Go to [DEFINE USER](/docs/surrealdb/surrealql/statements/define/user) for more information. ### Example: Define a Root-level user @@ -108,7 +108,7 @@ curl -X POST \ Scope is the term we use to describe the mechanism SurrealDB offers to define your own signin and signup logic. This feature contributes to making SurrealDB an all-in-one BaaS (Backend-as-a-Service). -Scopes are defined with the [DEFINE SCOPE](/docs/surrealdb/1.x/surrealql/statements/define/scope) statement. A scope is configured with the following config: +Scopes are defined with the [DEFINE SCOPE](/docs/surrealdb/surrealql/statements/define/scope) statement. A scope is configured with the following config: - `SIGNUP`: Defines the logic for when a user signs up to the scope. It usually creates a new entry to a table - `SIGNIN`: Defines the logic for when a user signs in to the scope. It usually check the provided credentials against the data in a table @@ -116,7 +116,7 @@ Scopes are defined with the [DEFINE SCOPE](/docs/surrealdb/1.x/surrealql/stateme By default, scopes have no permissions. They don't use the RBAC system and can only view data if allowed by a `PERMISSIONS` clause, which is defined on every data resource (i.e. tables) -Go to [DEFINE SCOPE](/docs/surrealdb/1.x/surrealql/statements/define/scope) for more information. +Go to [DEFINE SCOPE](/docs/surrealdb/surrealql/statements/define/scope) for more information. ### Example: Setup scope authentication diff --git a/versioned_docs/version-1.x/security/capabilities.mdx b/versioned_docs/version-1.x/security/capabilities.mdx index 60f13f39b..83a403de1 100644 --- a/versioned_docs/version-1.x/security/capabilities.mdx +++ b/versioned_docs/version-1.x/security/capabilities.mdx @@ -89,7 +89,7 @@ There was a problem with the database: There was a problem with the database: IA ## Functions -SurrealDB offers [built-in functions](/docs/surrealdb/1.x/surrealql/functions/array) to perform common operations like string manipulation, math, etc. Users can also define [their own functions](/docs/surrealdb/1.x/surrealql/statements/define/function) with custom logic. +SurrealDB offers [built-in functions](/docs/surrealdb/surrealql/functions/array) to perform common operations like string manipulation, math, etc. Users can also define [their own functions](/docs/surrealdb/surrealql/statements/define/function) with custom logic. In certain environments, you may not want users to use specific functions (i.e. http::*) or execute any custom function at all. You can use the allow/deny lists to configure what functions are allowed and what functions are denied. diff --git a/versioned_docs/version-1.x/surrealql/datamodel/datetimes.mdx b/versioned_docs/version-1.x/surrealql/datamodel/datetimes.mdx index 870dcc6ed..6590f4f63 100644 --- a/versioned_docs/version-1.x/surrealql/datamodel/datetimes.mdx +++ b/versioned_docs/version-1.x/surrealql/datamodel/datetimes.mdx @@ -63,4 +63,4 @@ Durations can be specified in any of the following units: | `y` | Years | ## Next steps -You've now seen how to store, modify, and handle dates and times in SurrealDB. For more advanced functionality, take a look at the [time](/docs/surrealdb/1.x/surrealql/functions/time) functions, which enable extracting, altering, rounding, and grouping datetimes into specific time intervals. \ No newline at end of file +You've now seen how to store, modify, and handle dates and times in SurrealDB. For more advanced functionality, take a look at the [time](/docs/surrealdb/surrealql/functions/time) functions, which enable extracting, altering, rounding, and grouping datetimes into specific time intervals. \ No newline at end of file diff --git a/versioned_docs/version-1.x/surrealql/datamodel/geometries.mdx b/versioned_docs/version-1.x/surrealql/datamodel/geometries.mdx index ae49b9200..a3b713759 100644 --- a/versioned_docs/version-1.x/surrealql/datamodel/geometries.mdx +++ b/versioned_docs/version-1.x/surrealql/datamodel/geometries.mdx @@ -229,4 +229,4 @@ UPDATE university:oxford SET buildings = { ## Next steps -You've now seen how to use geometries to store locations, paths, and polygonal areas in SurrealDB. For more advanced functionality, take a look at the [operators](/docs/surrealdb/1.x/surrealql/operators) and [geo](/docs/surrealdb/1.x/surrealql/functions/geo) functions, which enable area, distance, and bearing geometric calculations, and the ability to detect whether geometries contain or intersect other geometry types. \ No newline at end of file +You've now seen how to use geometries to store locations, paths, and polygonal areas in SurrealDB. For more advanced functionality, take a look at the [operators](/docs/surrealdb/surrealql/operators) and [geo](/docs/surrealdb/surrealql/functions/geo) functions, which enable area, distance, and bearing geometric calculations, and the ability to detect whether geometries contain or intersect other geometry types. \ No newline at end of file diff --git a/versioned_docs/version-1.x/surrealql/demo.mdx b/versioned_docs/version-1.x/surrealql/demo.mdx index 62a1b7d87..ef4e7a951 100644 --- a/versioned_docs/version-1.x/surrealql/demo.mdx +++ b/versioned_docs/version-1.x/surrealql/demo.mdx @@ -10,15 +10,15 @@ import useBaseUrl from '@docusaurus/useBaseUrl'; # Demo data -To quickly test out SurrealDB and SurrealQL functionality, we've included demo data here in `.surql` files which you can download and [`import`](/docs/surrealdb/1.x/cli/import) into SurrealDB using the CLI +To quickly test out SurrealDB and SurrealQL functionality, we've included demo data here in `.surql` files which you can download and [`import`](/docs/surrealdb/cli/import) into SurrealDB using the CLI ## Surreal Deal - deals so good it's surreal! Surreal Deal is a demo dataset based on a simplified e-commerce platform that sells artwork. -The dataset is made up of 8 tables using both [graph relations](/docs/surrealdb/1.x/surrealql/statements/relate) and [record links](/docs/surrealdb/1.x/surrealql/datamodel/records): +The dataset is made up of 8 tables using both [graph relations](/docs/surrealdb/surrealql/statements/relate) and [record links](/docs/surrealdb/surrealql/datamodel/records): `person`, `order`, `product`, `review`, `artist`, `create`, `avg_product_review`, `daily_sales`. -In the diagram below, the nodes in pink are the [standard tables](/docs/surrealdb/1.x/surrealql/statements/define/table), the ones in purple represent the [edge tables](/docs/surrealdb/1.x/surrealql/statements/relate) which shows relationships between records and SurrealDB as a graph database. While the nodes in gray are the [pre-computed table views](/docs/surrealdb/1.x/surrealql/statements/define/table). +In the diagram below, the nodes in pink are the [standard tables](/docs/surrealdb/surrealql/statements/define/table), the ones in purple represent the [edge tables](/docs/surrealdb/surrealql/statements/relate) which shows relationships between records and SurrealDB as a graph database. While the nodes in gray are the [pre-computed table views](/docs/surrealdb/surrealql/statements/define/table). array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::add(["one", "two"], "three"); @@ -212,7 +212,7 @@ The `array::all` function checks whether all array values are truthy. ```surql title="API DEFINITION" array::all(array) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::all([ 1, 2, 3, NONE, 'SurrealDB', 5 ]); @@ -229,7 +229,7 @@ The `array::any` function checks whether any array values are truthy. ```surql title="API DEFINITION" array::any(array) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::any([ 1, 2, 3, NONE, 'SurrealDB', 5 ]); @@ -246,7 +246,7 @@ The `array::at` function returns value for X index, or in reverse for a negative ```surql title="API DEFINITION" array::at(array, index) -> any ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::at(['s', 'u', 'r', 'r', 'e', 'a', 'l'], 2); @@ -269,7 +269,7 @@ The `array::append` function appends a value to the end of an array. ```surql title="API DEFINITION" array::append(array, value) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::append([1, 2, 3, 4], 5); @@ -287,7 +287,7 @@ If one array is shorter than the other it is considered null and thus false. ```surql title="API DEFINITION" array::boolean_and(lh: Array, rh: Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::boolean_and(["true", "false", 1, 1], ["true", "true", 0, "true"]); @@ -312,7 +312,7 @@ It takes two arrays and if one array is shorter than the other or missing, the o ```surql title="API DEFINITION" array::boolean_or(lh: Array, rh: Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::boolean_or([false, true, false, true], [false, false, true, true]) @@ -329,7 +329,7 @@ The `array::boolean_xor` Performs the [XOR bitwise operations](https://developer ```surql title="API DEFINITION" array::boolean_xor(lh: Array, rh: Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::boolean_xor([false, true, false, true], [false, false, true, true]); @@ -347,7 +347,7 @@ It takes in one array and it returns false if its single operand can be converte ```surql title="API DEFINITION" array::boolean_not(Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::boolean_not([ false, true, 0, 1 ]); @@ -364,7 +364,7 @@ The `array::combine` function combines all values from two arrays together, retu ```surql title="API DEFINITION" array::combine(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::combine([1,2], [2,3]); @@ -381,7 +381,7 @@ The `array::complement` function returns the complement of two arrays, returning ```surql title="API DEFINITION" array::complement(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::complement([1,2,3,4], [3,4,5,6]); @@ -393,12 +393,12 @@ RETURN array::complement([1,2,3,4], [3,4,5,6]); ## `array::concat` -The `array::concat` function merges two arrays together, returning an array which may contain duplicate values. If you want to remove duplicate values from the resulting array, then use the [`array::union()`](/docs/surrealdb/1.x/surrealql/functions/array#arrayunion) function +The `array::concat` function merges two arrays together, returning an array which may contain duplicate values. If you want to remove duplicate values from the resulting array, then use the [`array::union()`](/docs/surrealdb/surrealql/functions/array#arrayunion) function ```surql title="API DEFINITION" array::concat(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::concat([1,2,3,4], [3,4,5,6]); @@ -415,7 +415,7 @@ The `array::clump` function returns the original array split into sub-arrays of ```surql title="API DEFINITION" array::clump(array, value) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::clump([0, 1, 2, 3], 2); @@ -432,7 +432,7 @@ The `array::difference` determines the difference between two arrays, returning ```surql title="API DEFINITION" array::difference(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::difference([1,2,3,4], [3,4,5,6]); @@ -449,7 +449,7 @@ The `array::distinct` function calculates the unique values in an array, returni ```surql title="API DEFINITION" array::distinct(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::distinct([ 1, 2, 1, 3, 3, 4 ]); @@ -466,7 +466,7 @@ The `array::flatten` flattens an array of arrays, returning a new array with all ```surql title="API DEFINITION" array::flatten(array, index) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::flatten([ [1,2], [3, 4], 'SurrealDB', [5, 6, [7, 8]] ]); @@ -483,7 +483,7 @@ The `array::find_index` Returns the index of the first occurrence of `value` in ```surql title="API DEFINITION" array::find_index(array, index) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::find_index(['a', 'b', 'c', 'b', 'a'], 'b'); @@ -500,7 +500,7 @@ The `array::filter_index` finds the indexes of all occurrences of all matching v ```surql title="API DEFINITION" array::filter_index(array, index) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::filter_index(['a', 'b', 'c', 'b', 'a'], 'b'); @@ -517,7 +517,7 @@ The `array::first` function returns the first value from an array. ```surql title="API DEFINITION" array::first(array) -> any ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::first([ 's', 'u', 'r', 'r', 'e', 'a', 'l' ]); @@ -534,7 +534,7 @@ The `array::group` function flattens and returns the unique items in an array. ```surql title="API DEFINITION" array::group(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::group([1, 2, 3, 4, [3,5,6], [2,4,5,6], 7, 8, 8, 9]); @@ -551,7 +551,7 @@ The `array::insert` function inserts a value into an array at a specific positi ```surql title="API DEFINITION" array::insert(array, value, number) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::insert([1,2,3,4], 5, 2); @@ -568,7 +568,7 @@ The `array::intersect` function calculates the values which intersect two arrays ```surql title="API DEFINITION" array::intersect(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::intersect([1,2,3,4], [3,4,5,6]); @@ -585,7 +585,7 @@ The `array::join` function takes an array and a string as parameters and returns ```surql title="API DEFINITION" array::join(array, string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::join(["again", "again", "again"], " and "); @@ -602,7 +602,7 @@ The `array::last`function returns the last value from an array. ```surql title="API DEFINITION" array::last(array) -> any ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::last([ 's', 'u', 'r', 'r', 'e', 'a', 'l' ]); @@ -614,11 +614,11 @@ RETURN array::last([ 's', 'u', 'r', 'r', 'e', 'a', 'l' ]); ## `array::len` -The `array::len` function calculates the length of an array, returning a number. This function includes all items when counting the number of items in the array. If you want to only count truthy values, then use the [count()](/docs/surrealdb/1.x/surrealql/functions/count) function. +The `array::len` function calculates the length of an array, returning a number. This function includes all items when counting the number of items in the array. If you want to only count truthy values, then use the [count()](/docs/surrealdb/surrealql/functions/count) function. ```surql title="API DEFINITION" array::len(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::len([ 1, 2, 1, null, "something", 3, 3, 4, 0 ]); @@ -635,7 +635,7 @@ The `array::logical_and` performs the [`AND` logical operations](https://develop ```surql title="API DEFINITION" array::logical_and(lh: Array, rh: Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::logical_and([true, false, true, false], [true, true, false, false]); @@ -660,7 +660,7 @@ The `array::logical_or` Performs the [`OR` logical operations](https://developer ```surql title="API DEFINITION" array::logical_or(lh: Array, rh: Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::logical_or([true, false, true, false], [true, true, false, false]); @@ -685,7 +685,7 @@ The `array::logical_or` performs the [`XOR` logical operations](https://develope ```surql title="API DEFINITION" array::logical_xor(lh: Array, rh: Array) ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::logical_xor([true, false, true, false], [true, true, false, false]); @@ -709,7 +709,7 @@ The `array::max` returns the maximum item in an array ```surql title="API DEFINITION" array::max(Array) -> any ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::max([0, 1, 2]); @@ -727,7 +727,7 @@ The `array::matches` returns an array of booleans ```surql title="API DEFINITION" array::matches(Array,value) -> Array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::matches([0, 1, 2], 1); @@ -752,7 +752,7 @@ The `array::min` returns the minimum item in an array ```surql title="API DEFINITION" array::min(Array) -> any ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::min([0, 1, 2]); @@ -770,7 +770,7 @@ The `array::pop` function removes a value from the end of an array and returns i ```surql title="API DEFINITION" array::pop(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::pop([ 1, 2, 3, 4 ]); @@ -788,7 +788,7 @@ The `array::prepend` function prepends a value to the beginning of an array. ```surql title="API DEFINITION" array::prepend(array, value) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::prepend([1,2,3,4], 5); @@ -806,7 +806,7 @@ The `array::push` function prepends a value to the end of an array. ```surql title="API DEFINITION" array::push(array, value) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::push([1,2,3,4], 5); @@ -824,7 +824,7 @@ The `array::remove` function removes an item from a specific position in an arra ```surql title="API DEFINITION" array::remove(array, number) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::remove([1,2,3,4,5], 2); @@ -849,7 +849,7 @@ The `array::reverse` function reverses the sorting order of an array. ```surql title="API DEFINITION" array::reverse(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::reverse([ 1, 2, 3, 4, 5 ]); @@ -879,7 +879,7 @@ The function also accepts a second string parameter which determines the sorting array::sort(array, string) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::sort([ 1, 2, 1, null, "something", 3, 3, 4, 0 ]); @@ -912,7 +912,7 @@ The `array::slice` returns a slice of an array, based on a starting position, an ```surql title="API DEFINITION" array::slice(array, start, len) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::slice([ 1, 2, 3, 4, 5 ], 1, 2); @@ -960,7 +960,7 @@ The `array::sort::asc` function is a shorthand convenience function for the `arr ```surql title="API DEFINITION" array::sort::asc(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::sort::asc([ 1, 2, 1, null, "something", 3, 3, 4, 0 ]); @@ -978,7 +978,7 @@ The `array::sort::desc` function is a shorthand convenience function for the `ar ```surql title="API DEFINITION" array::sort::desc(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::sort::desc([ 1, 2, 1, null, "something", 3, 3, 4, 0 ]); @@ -996,7 +996,7 @@ The `array::transpose` is used to perform 2d array transposition but it's behavi ```surql title="API DEFINITION" array::transpose(array, array) -> array array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::transpose([[0, 1], [2, 3]]); @@ -1014,7 +1014,7 @@ The `array::union` function combines two arrays together, removing duplicate val ```surql title="API DEFINITION" array::union(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN array::union([1,2,1,6], [1,3,4,5,6]); diff --git a/versioned_docs/version-1.x/surrealql/functions/count.mdx b/versioned_docs/version-1.x/surrealql/functions/count.mdx index 6bed0ec69..c03aad2cb 100644 --- a/versioned_docs/version-1.x/surrealql/functions/count.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/count.mdx @@ -31,18 +31,18 @@ The count function counts the number of times that the function is called. This ```surql title="API DEFINITION" count() -> 1 ``` -If a value is given as the first argument, then this function checks whether a given value is truthy. This is useful for returning the total number of rows, which match a certain condition, in a [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/select) statement, with a GROUP BY clause. +If a value is given as the first argument, then this function checks whether a given value is truthy. This is useful for returning the total number of rows, which match a certain condition, in a [`SELECT`](/docs/surrealdb/surrealql/statements/select) statement, with a GROUP BY clause. ```surql title="API DEFINITION" count(any) -> number ``` -If an array is given, this function counts the number of items in the array which are truthy. If, instead, you want to count the total number of items in the given array, then use the [`array::len()`](/docs/surrealdb/1.x/surrealql/functions/array#arraylen) function. +If an array is given, this function counts the number of items in the array which are truthy. If, instead, you want to count the total number of items in the given array, then use the [`array::len()`](/docs/surrealdb/surrealql/functions/array#arraylen) function. ```surql title="API DEFINITION" count(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN count(); @@ -64,7 +64,7 @@ RETURN count([ 1, 2, 3, null, 0, false, (15 > 10), rand::uuid() ]); 5 ``` -The following examples show this function being used in a [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/select) statement with a GROUP clause: +The following examples show this function being used in a [`SELECT`](/docs/surrealdb/surrealql/statements/select) statement with a GROUP clause: ```surql SELECT count() FROM [{ age: 33 }, { age: 45 }, { age: 39 }] GROUP ALL; diff --git a/versioned_docs/version-1.x/surrealql/functions/crypto.mdx b/versioned_docs/version-1.x/surrealql/functions/crypto.mdx index 860ae7102..1fda77b2b 100644 --- a/versioned_docs/version-1.x/surrealql/functions/crypto.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/crypto.mdx @@ -75,7 +75,7 @@ The `crypto::md5` function returns the md5 hash of the input value. ```surql title="API DEFINITION" crypto::md5(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::md5("tobie"); @@ -92,7 +92,7 @@ The `crypto::sha1` function returns the sha1 hash of the input value. ```surql title="API DEFINITION" crypto::sha1(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::sha1("tobie"); @@ -109,7 +109,7 @@ The `crypto::sha256` function returns the sha256 hash of the input value. ```surql title="API DEFINITION" crypto::sha256(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::sha256("tobie"); @@ -126,7 +126,7 @@ The `crypto::sha512` function returns the sha512 hash of the input value. ```surql title="API DEFINITION" crypto::sha512(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::sha512("tobie"); @@ -143,7 +143,7 @@ The `crypto::argon2::compare` function compares a hashed-and-salted argon2 passw ```surql title="API DEFINITION" crypto::argon2::compare(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql LET $hash = "$argon2id$v=19$m=4096,t=3,p=1$pbZ6yJ2rPJKk4pyEMVwslQ$jHzpsiB+3S/H+kwFXEcr10vmOiDkBkydVCSMfRxV7CA"; @@ -167,7 +167,7 @@ The `crypto::argon2::generate` function hashes and salts a password using the ar ```surql title="API DEFINITION" crypto::argon2::generate(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::argon2::generate("this is a strong password"); @@ -184,7 +184,7 @@ The `crypto::bcrypt::compare` function compares a hashed-and-salted bcrypt passw ```surql title="API DEFINITION" crypto::bcrypt::compare(string, any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql LET $hash = "$2b$12$OD7hrr1Hycyk8NUwOekYY.cogCICpUnwNvDZ9NiC1qCPHzpVAQ9BO"; @@ -207,7 +207,7 @@ The `crypto::bcrypt::generate` function hashes and salts a password using the bc ```surql title="API DEFINITION" crypto::bcrypt::generate(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::bcrypt::generate("this is a strong password"); @@ -224,7 +224,7 @@ The `crypto::pbkdf2::compare` function compares a hashed-and-salted pbkdf2 passw ```surql title="API DEFINITION" crypto::pbkdf2::compare(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql LET $hash = "$pbkdf2-sha256$i=10000,l=32$DBURRPJODKEt0IId1Lqe+w$Ve8Z00mibHDSKLbyKTceEBBcDpGoK0AEUl7QzDTIec4"; @@ -248,7 +248,7 @@ The `crypto::pbkdf2::generate` function hashes and salts a password using the pb ```surql title="API DEFINITION" crypto::pbkdf2::generate(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::pbkdf2::generate("this is a strong password"); @@ -265,7 +265,7 @@ The `crypto::scrypt::compare` function compares a hashed-and-salted scrypt passw ```surql title="API DEFINITION" crypto::scrypt::compare(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql LET $hash = "$scrypt$ln=15,r=8,p=1$8gl7bipl0FELTy46YJOBrw$eRcS1qR22GI8VHo58WOXn9JyfDivGo5yTJFvpDyivuw"; @@ -289,7 +289,7 @@ The `crypto::scrypt::generate` function hashes and salts a password using the sc ```surql title="API DEFINITION" crypto::scrypt::generate(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN crypto::scrypt::generate("this is a strong password"); diff --git a/versioned_docs/version-1.x/surrealql/functions/duration.mdx b/versioned_docs/version-1.x/surrealql/functions/duration.mdx index ccbc5fbcb..595debddf 100644 --- a/versioned_docs/version-1.x/surrealql/functions/duration.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/duration.mdx @@ -95,7 +95,7 @@ The `duration::days` function counts how many days fit into a duration. ```surql title="API DEFINITION" duration::days(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::days(3w); @@ -113,7 +113,7 @@ The `duration::hours` function counts how many hours fit into a duration. ```surql title="API DEFINITION" duration::hours(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::hours(3w); @@ -131,7 +131,7 @@ The `duration::micros` function counts how many microseconds fit into a duration ```surql title="API DEFINITION" duration::micros(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::micros(3w); @@ -149,7 +149,7 @@ The `duration::millis` function counts how many milliseconds fit into a duration ```surql title="API DEFINITION" duration::millis(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::millis(3w); @@ -167,7 +167,7 @@ The `duration::mins` function counts how many minutes fit into a duration. ```surql title="API DEFINITION" duration::mins(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::mins(3w); @@ -185,7 +185,7 @@ The `duration::nanos` function counts how many nanoseconds fit into a duration. ```surql title="API DEFINITION" duration::nanos(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::nanos(3w); @@ -202,7 +202,7 @@ The `duration::secs` function counts how many seconds fit into a duration. ```surql title="API DEFINITION" duration::secs(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::secs(3w); @@ -219,7 +219,7 @@ The `duration::weeks` function counts how many weeks fit into a duration. ```surql title="API DEFINITION" duration::weeks(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::weeks(3w); @@ -236,7 +236,7 @@ The `duration::years` function counts how many years fit into a duration. ```surql title="API DEFINITION" duration::years(duration) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::years(300w); @@ -253,7 +253,7 @@ The `duration::years` function counts how many years fit into a duration. ```surql title="API DEFINITION" duration::from::days(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::days(3); @@ -270,7 +270,7 @@ The `duration::from::hours` function converts a numeric amount of hours into a d ```surql title="API DEFINITION" duration::from::hours(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::hours(3); @@ -287,7 +287,7 @@ The `duration::from::micros` function converts a numeric amount of microseconds ```surql title="API DEFINITION" duration::from::micros(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::micros(3); @@ -304,7 +304,7 @@ The `duration::from::millis` function converts a numeric amount of milliseconds ```surql title="API DEFINITION" duration::from::millis(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::millis(3); @@ -321,7 +321,7 @@ The `duration::from::mins` function converts a numeric amount of minutes into a ```surql title="API DEFINITION" duration::from::mins(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::mins(3); @@ -338,7 +338,7 @@ The `duration::from::nanos` function converts a numeric amount of nanoseconds in ```surql title="API DEFINITION" duration::from::nanos(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::nanos(3); @@ -355,7 +355,7 @@ The `duration::from::secs` function converts a numeric amount of seconds into a ```surql title="API DEFINITION" duration::from::secs(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::secs(3); @@ -372,7 +372,7 @@ The `duration::from::days` function converts a numeric amount of weeks into a du ```surql title="API DEFINITION" duration::from::weeks(number) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN duration::from::weeks(3); diff --git a/versioned_docs/version-1.x/surrealql/functions/geo.mdx b/versioned_docs/version-1.x/surrealql/functions/geo.mdx index 28fd57370..15822b083 100644 --- a/versioned_docs/version-1.x/surrealql/functions/geo.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/geo.mdx @@ -51,7 +51,7 @@ The `geo::area` function calculates the area of a geometry. ```surql title="API DEFINITION" geo::area(geometry) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN geo::area({ @@ -65,7 +65,7 @@ RETURN geo::area({ 0.13350018278702186 ``` -If the argument is not a geometry type, then an [`EMPTY`](/docs/surrealdb/1.x/surrealql/datamodel/simple) value will be returned: +If the argument is not a geometry type, then an [`EMPTY`](/docs/surrealdb/surrealql/datamodel/simple) value will be returned: ```surql RETURN geo::area(12345); @@ -82,7 +82,7 @@ The `geo::bearing` function calculates the bearing between two geolocation point ```surql title="API DEFINITION" geo::bearing(point, point) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN geo::area({ @@ -90,7 +90,7 @@ RETURN geo::bearing( (51.509865, -0.118092), (-0.118092, 51.509865) ); -31.913259585079818 ``` -If either argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/1.x/surrealql/datamodel/simple) value will be returned: +If either argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/surrealql/datamodel/simple) value will be returned: ```surql RETURN geo::bearing(12345, true); @@ -107,7 +107,7 @@ The `geo::centroid` function calculates the centroid between two geolocation poi ```surql title="API DEFINITION" geo::centroid(geometry) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN geo::centroid({ @@ -128,7 +128,7 @@ RETURN geo::centroid({ ] } ``` -If either argument is not a geometry type, then an [`EMPTY`](/docs/surrealdb/1.x/surrealql/datamodel/simple) value will be returned: +If either argument is not a geometry type, then an [`EMPTY`](/docs/surrealdb/surrealql/datamodel/simple) value will be returned: ```surql RETURN geo::centroid(12345); @@ -145,14 +145,14 @@ The `geo::distance` function calculates the haversine distance, in metres, betwe ```surql title="API DEFINITION" geo::distance(point, point) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN geo::distance( (51.509865, -0.118092), (-0.118092, 51.509865) ); 7491494.807105545 ``` -If either argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/1.x/surrealql/datamodel/simple) value will be returned: +If either argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/surrealql/datamodel/simple) value will be returned: ```surql RETURN geo::distance(12345, true); @@ -169,7 +169,7 @@ The `geo::hash::decode` function converts a geohash into a geolocation point. ```surql title="API DEFINITION" geo::hash::decode(point) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN geo::hash::decode("mpuxk4s24f51"); @@ -183,7 +183,7 @@ RETURN geo::hash::decode("mpuxk4s24f51"); ] } ``` -If the argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/1.x/surrealql/datamodel/simple) value will be returned: +If the argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/surrealql/datamodel/simple) value will be returned: ```surql RETURN geo::hash::decode(12345); @@ -206,7 +206,7 @@ The function accepts a second argument, which determines the accuracy and granul geo::hash::encode(point, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN geo::hash::encode( (51.509865, -0.118092) ); @@ -220,7 +220,7 @@ RETURN geo::hash::encode( (51.509865, -0.118092), 5 ); "mpuxk" ``` -If the first argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/1.x/surrealql/datamodel/simple) value will be returned: +If the first argument is not a geolocation point, then an [`EMPTY`](/docs/surrealdb/surrealql/datamodel/simple) value will be returned: ```surql RETURN geo::hash::encode(12345); diff --git a/versioned_docs/version-1.x/surrealql/functions/http.mdx b/versioned_docs/version-1.x/surrealql/functions/http.mdx index cdff2d18d..f396d8237 100644 --- a/versioned_docs/version-1.x/surrealql/functions/http.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/http.mdx @@ -57,7 +57,7 @@ If an object is given as the second argument, then this can be used to set the r http::head(string, object) -> null ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN http::head('https://surrealdb.com'); @@ -90,7 +90,7 @@ If an object is given as the second argument, then this can be used to set the r http::get(string, object) -> value ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN http::get('https://surrealdb.com'); @@ -123,7 +123,7 @@ If an object is given as the second argument, then this can be used to set the r http::put(string, object, object) -> value ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN http::put('https://dummyjson.com/comments', { @@ -163,7 +163,7 @@ If an object is given as the second argument, then this can be used to set the r http::post(string, object, object) -> value ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN http::post('https://dummyjson.com/comments/1', { @@ -203,7 +203,7 @@ If an object is given as the second argument, then this can be used to set the r http::patch(string, object, object) -> value ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN http::patch('https://dummyjson.com/comments/1', { @@ -243,7 +243,7 @@ If an object is given as the second argument, then this can be used to set the r http::delete(string, object) -> value ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN http::delete('https://dummyjson.com/comments/1'); diff --git a/versioned_docs/version-1.x/surrealql/functions/math.mdx b/versioned_docs/version-1.x/surrealql/functions/math.mdx index 16c0b8237..f9f392d0e 100644 --- a/versioned_docs/version-1.x/surrealql/functions/math.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/math.mdx @@ -119,7 +119,7 @@ The `math::abs` function returns the absolute value of a number. ```surql title="API DEFINITION" math::abs(number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::abs(-13.746189); @@ -136,7 +136,7 @@ The `math::bottom` function returns the bottom X set of numbers in a set of numb ```surql title="API DEFINITION" math::bottom(array, number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::bottom([1, 2, 3], 2); @@ -153,7 +153,7 @@ The `math::ceil` function rounds a number up to the next largest integer. ```surql title="API DEFINITION" math::ceil(number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::ceil(13.146572); @@ -170,7 +170,7 @@ The `math::fixed` function returns a number with the specified number of decimal ```surql title="API DEFINITION" math::fixed(number, number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::fixed(13.146572, 2); @@ -187,7 +187,7 @@ The `math::floor` function rounds a number down to the nearest integer. ```surql title="API DEFINITION" math::floor(number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::floor(13.746189); @@ -204,7 +204,7 @@ The `math::interquartile` function returns the interquartile of an array of numb ```surql title="API DEFINITION" math::interquartile(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::interquartile([ 1, 40, 60, 10, 2, 901 ]); @@ -221,7 +221,7 @@ The `math::max` function returns the maximum number in a set of numbers. ```surql title="API DEFINITION" math::max(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::max([ 26.164, 13.746189, 23, 16.4, 41.42 ]); @@ -238,7 +238,7 @@ The `math::mean` function returns the mean of a set of numbers. ```surql title="API DEFINITION" math::mean(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::mean([ 26.164, 13.746189, 23, 16.4, 41.42 ]); @@ -255,7 +255,7 @@ The `math::median` function returns the median of a set of numbers. ```surql title="API DEFINITION" math::median(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::median([ 26.164, 13.746189, 23, 16.4, 41.42 ]); @@ -272,7 +272,7 @@ The `math::midhinge` function returns the midhinge of an array of numbers. ```surql title="API DEFINITION" math::midhinge(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::midhinge([ 1, 40, 60, 10, 2, 901 ]); @@ -289,7 +289,7 @@ The `math::min` function returns the minimum number in a set of numbers. ```surql title="API DEFINITION" math::min(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::min([ 26.164, 13.746189, 23, 16.4, 41.42 ]); @@ -306,7 +306,7 @@ The `math::mode` function returns the value that occurs most often in a set of n ```surql title="API DEFINITION" math::mode(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::mode([ 1, 40, 60, 10, 2, 901 ]); @@ -323,7 +323,7 @@ The `math::nearestrank` function returns the nearestrank of an array of numbers. ```surql title="API DEFINITION" math::nearestrank(array, number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::nearestrank([1, 40, 60, 10, 2, 901], 50); @@ -340,7 +340,7 @@ The `math::percentile` function returns the value below which a percentage of da ```surql title="API DEFINITION" math::percentile(array, number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::percentile([1, 40, 60, 10, 2, 901], 50); @@ -357,7 +357,7 @@ The `math::product` function returns the product of a set of numbers. ```surql title="API DEFINITION" math::product(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::product([ 26.164, 13.746189, 23, 16.4, 41.42 ]); @@ -374,7 +374,7 @@ The `math::round` function rounds a number up or down to the nearest integer. ```surql title="API DEFINITION" math::round(number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::round(13.53124); @@ -391,7 +391,7 @@ The `math::spread` function returns the spread of an array of numbers. ```surql title="API DEFINITION" math::spread(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::spread([ 1, 40, 60, 10, 2, 901 ]); @@ -408,7 +408,7 @@ The `math::sqrt` function returns the square root of a number. ```surql title="API DEFINITION" math::sqrt(number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::sqrt(15); @@ -425,7 +425,7 @@ The `math::stddev` function calculates how far a set of numbers are away from th ```surql title="API DEFINITION" math::stddev(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::stddev([ 1, 40, 60, 10, 2, 901 ]); @@ -442,7 +442,7 @@ The `math::sum` function returns the total sum of a set of numbers. ```surql title="API DEFINITION" math::sum(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::sum([ 26.164, 13.746189, 23, 16.4, 41.42 ]); @@ -459,7 +459,7 @@ The `math::top` function returns the top of an array of numbers. ```surql title="API DEFINITION" math::top(array, number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::top([1, 40, 60, 10, 2, 901], 3); @@ -476,7 +476,7 @@ The `math::trimean` function returns the trimean of an array of numbers. ```surql title="API DEFINITION" math::trimean(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::trimean([ 1, 40, 60, 10, 2, 901 ]); @@ -493,7 +493,7 @@ The `math::variance` function returns the variance of an array of numbers. ```surql title="API DEFINITION" math::variance(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN math::variance([ 1, 40, 60, 10, 2, 901 ]); diff --git a/versioned_docs/version-1.x/surrealql/functions/meta.mdx b/versioned_docs/version-1.x/surrealql/functions/meta.mdx index cf308498c..f34612fdb 100644 --- a/versioned_docs/version-1.x/surrealql/functions/meta.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/meta.mdx @@ -35,7 +35,7 @@ The `meta::id` function extracts and returns the table id from a SurrealDB Recor ```surql title="API DEFINITION" meta::id(record) -> value ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN meta::id(person:tobie); @@ -52,7 +52,7 @@ The `meta::tb` function extracts and returns the table name from a SurrealDB Rec ```surql title="API DEFINITION" meta::tb(record) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN meta::tb(person:tobie); diff --git a/versioned_docs/version-1.x/surrealql/functions/ml.mdx b/versioned_docs/version-1.x/surrealql/functions/ml.mdx index d32bb6308..0ae02305f 100644 --- a/versioned_docs/version-1.x/surrealql/functions/ml.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/ml.mdx @@ -50,7 +50,7 @@ Here, we are using the key mappings in the header of the `.surml` file uploaded in the object passed into the `ml::` function in the correct order. If there are any normalisation parameters in the header of the `.surml` file, these will also be applied. -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN ml::house-price-prediction<0.0.1>({squarefoot: 500.0, num_floors: 1.0}); diff --git a/versioned_docs/version-1.x/surrealql/functions/object.mdx b/versioned_docs/version-1.x/surrealql/functions/object.mdx index a78b1fe55..9b040a13a 100644 --- a/versioned_docs/version-1.x/surrealql/functions/object.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/object.mdx @@ -47,7 +47,7 @@ The `object::entries` function transforms an object into an array with arrays of ```surql title="API DEFINITION" object::entries(object) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN object::entries({ @@ -70,7 +70,7 @@ The `object::from_entries` function transforms an array with arrays of key-value ```surql title="API DEFINITION" object::from_entries(array) -> object ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN object::from_entries([ @@ -93,7 +93,7 @@ The `object::keys` function returns an array with all the keys of an object. ```surql title="API DEFINITION" object::keys(object) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN object::keys({ @@ -113,7 +113,7 @@ The `object::len` function returns the amount of key-value pairs an object holds ```surql title="API DEFINITION" object::len(object) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN object::len({ @@ -133,7 +133,7 @@ The `object::values` function returns an array with all the values of an object. ```surql title="API DEFINITION" object::values(object) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN object::values({ diff --git a/versioned_docs/version-1.x/surrealql/functions/parse.mdx b/versioned_docs/version-1.x/surrealql/functions/parse.mdx index edffd2f1c..e45b2f7d6 100644 --- a/versioned_docs/version-1.x/surrealql/functions/parse.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/parse.mdx @@ -59,7 +59,7 @@ The `parse::email::host` function parses and returns and email host from a valid ```surql title="API DEFINITION" parse::email::host(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::email::host("info@surrealdb.com"); @@ -76,7 +76,7 @@ The `parse::email::user` function parses and returns and email username from a v ```surql title="API DEFINITION" parse::email::user(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::email::user("info@surrealdb.com"); @@ -93,7 +93,7 @@ The `parse::url::domain` function parses and returns and email domain from a val ```surql title="API DEFINITION" parse::url::domain(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::url::domain("https://surrealdb.com:80/features?some=option#fragment"); @@ -110,7 +110,7 @@ The `parse::url::fragment` function parses and returns the fragment from a valid ```surql title="API DEFINITION" parse::url::fragment(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::url::fragment("https://surrealdb.com:80/features?some=option#fragment"); @@ -127,7 +127,7 @@ The `parse::url::host` function parses and returns the hostname from a valid URL ```surql title="API DEFINITION" parse::url::host(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::url::host("https://surrealdb.com:80/features?some=option#fragment"); @@ -144,7 +144,7 @@ The `parse::url::path` function parses and returns the path from a valid URL. ```surql title="API DEFINITION" parse::url::path(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::url::path("https://surrealdb.com:80/features?some=option#fragment"); @@ -161,7 +161,7 @@ The `parse::url::port` function parses and returns the port from a valid URL.. ```surql title="API DEFINITION" parse::url::port(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::url::port("https://surrealdb.com:80/features?some=option#fragment"); @@ -178,7 +178,7 @@ The `parse::url::query` function parses and returns the query from a valid URL. ```surql title="API DEFINITION" parse::url::query(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN parse::url::query("https://surrealdb.com:80/features?some=option#fragment"); diff --git a/versioned_docs/version-1.x/surrealql/functions/rand.mdx b/versioned_docs/version-1.x/surrealql/functions/rand.mdx index bb299b596..2132e1b7c 100644 --- a/versioned_docs/version-1.x/surrealql/functions/rand.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/rand.mdx @@ -70,19 +70,19 @@ These functions can be used when generating random data values. ## `rand` -The rand function generates a random [`float`](/docs/surrealdb/1.x/surrealql/datamodel/numbers#floating-point-numbers), between 0 and 1. +The rand function generates a random [`float`](/docs/surrealdb/surrealql/datamodel/numbers#floating-point-numbers), between 0 and 1. ```surql title="API DEFINITION" rand() -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand(); 0.7062321084863658 ``` -The following example shows this function being used in a [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/select) statement with an `ORDER BY` clause: +The following example shows this function being used in a [`SELECT`](/docs/surrealdb/surrealql/statements/select) statement with an `ORDER BY` clause: ```surql SELECT * FROM [{ age: 33 }, { age: 45 }, { age: 39 }] ORDER BY rand(); @@ -105,12 +105,12 @@ SELECT * FROM [{ age: 33 }, { age: 45 }, { age: 39 }] ORDER BY rand(); ## `rand::bool` -The rand::bool function generates a random [`boolean`](/docs/surrealdb/1.x/surrealql/datamodel/simple#booleans) value. +The rand::bool function generates a random [`boolean`](/docs/surrealdb/surrealql/datamodel/simple#booleans) value. ```surql title="API DEFINITION" rand::bool() -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::bool(); @@ -129,7 +129,7 @@ The `rand::enum` function generates a random value, from a multitude of values. ```surql title="API DEFINITION" rand::enum(value...) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::enum('one', 'two', 3, 4.15385, 'five', true); @@ -141,20 +141,20 @@ RETURN rand::enum('one', 'two', 3, 4.15385, 'five', true); ## `rand::float` -The `rand::float` function generates a random [`float`](/docs/surrealdb/1.x/surrealql/datamodel/numbers#floating-point-numbers), between `0` and `1`. +The `rand::float` function generates a random [`float`](/docs/surrealdb/surrealql/datamodel/numbers#floating-point-numbers), between `0` and `1`. ```surql title="API DEFINITION" rand::float() -> float ``` -If two numbers are provided, then the function generates a random [`float`](/docs/surrealdb/1.x/surrealql/datamodel/numbers#floating-point-numbers), between two numbers. +If two numbers are provided, then the function generates a random [`float`](/docs/surrealdb/surrealql/datamodel/numbers#floating-point-numbers), between two numbers. ```surql title="API DEFINITION" rand::float(number, number) -> float ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::float(); @@ -184,7 +184,7 @@ If a number is provided, then the function generates a random guid, with a speci rand::guid(number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::guid(); @@ -214,7 +214,7 @@ If two numbers are provided, then the function generates a random int, between t rand::int(number, number) -> int ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::int(); @@ -250,7 +250,7 @@ If two numbers are provided, then the function generates a random string, with a rand::string(number, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::string(); @@ -272,20 +272,20 @@ RETURN rand::string(10, 15); ## `rand::time` -The `rand::time` function generates a random [`datetime`](/docs/surrealdb/1.x/surrealql/datamodel/datetimes). +The `rand::time` function generates a random [`datetime`](/docs/surrealdb/surrealql/datamodel/datetimes). ```surql title="API DEFINITION" rand::time() -> datetime ``` -The rand::time function generates a random [`datetime`](/docs/surrealdb/1.x/surrealql/datamodel/datetimes), between two unix timestamps. +The rand::time function generates a random [`datetime`](/docs/surrealdb/surrealql/datamodel/datetimes), between two unix timestamps. ```surql title="API DEFINITION" rand::time(number, number) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::time(); @@ -308,7 +308,7 @@ The `rand::uuid` function generates a random UUID. rand::uuid() -> uuid ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::uuid(); @@ -326,7 +326,7 @@ The `rand::uuid::v4` function generates a random UUID. rand::uuid::v4() -> uuid ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::uuid::v4(); @@ -344,14 +344,14 @@ The `rand::uuid::v7` function generates a random Version 7 UUID. rand::uuid::v7() -> uuid ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::uuid::v7(); "01843a54-32e1-71eb-af07-5901fc190877" ``` -To enable `rand::uuid::v7` in [embedded mode](/docs/surrealdb/1.x/embedding/rust) you need to add the following to your `.cargo/config.toml` file in your project +To enable `rand::uuid::v7` in [embedded mode](/docs/surrealdb/embedding/rust) you need to add the following to your `.cargo/config.toml` file in your project ```toml [build] @@ -368,7 +368,7 @@ The `rand::ulid` function generates a random ULID. rand::ulid() -> ulid ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN rand::ulid(); diff --git a/versioned_docs/version-1.x/surrealql/functions/script/built-in-functions.mdx b/versioned_docs/version-1.x/surrealql/functions/script/built-in-functions.mdx index 9970909e1..7173436e7 100644 --- a/versioned_docs/version-1.x/surrealql/functions/script/built-in-functions.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/script/built-in-functions.mdx @@ -7,7 +7,7 @@ description: Besides basic JavaScript utilities and classes for SurrealQL types, # Built-in functions -Besides basic JavaScript utilities and [classes for SurrealQL types](/docs/surrealdb/1.x/surrealql/functions/script/type-conversion), there are a handful of utilities built into the embedded scripting functions. +Besides basic JavaScript utilities and [classes for SurrealQL types](/docs/surrealdb/surrealql/functions/script/type-conversion), there are a handful of utilities built into the embedded scripting functions.
diff --git a/versioned_docs/version-1.x/surrealql/functions/script/type-conversion.mdx b/versioned_docs/version-1.x/surrealql/functions/script/type-conversion.mdx index 12602f652..98659c8a1 100644 --- a/versioned_docs/version-1.x/surrealql/functions/script/type-conversion.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/script/type-conversion.mdx @@ -15,7 +15,7 @@ CREATE user:test SET created_at = function() { }; ``` -In addition, a number of special classes are included within the JavaScript functions for the additional types which are not built into JavaScript. These enable the creation of [`duration`](/docs/surrealdb/1.x/surrealql/datamodel/datetimes#datetimes-and-durations) values, [`record`](/docs/surrealdb/1.x/surrealql/datamodel/ids) ids, and [`UUID`](/docs/surrealdb/1.x/surrealql/datamodel/strings#uuid) values from within JavaScript. +In addition, a number of special classes are included within the JavaScript functions for the additional types which are not built into JavaScript. These enable the creation of [`duration`](/docs/surrealdb/surrealql/datamodel/datetimes#datetimes-and-durations) values, [`record`](/docs/surrealdb/surrealql/datamodel/ids) ids, and [`UUID`](/docs/surrealdb/surrealql/datamodel/strings#uuid) values from within JavaScript. Any values of these types passed into embedded scripting functions are also represented with these special classes. diff --git a/versioned_docs/version-1.x/surrealql/functions/search.mdx b/versioned_docs/version-1.x/surrealql/functions/search.mdx index ce1d575c2..f7b85d710 100644 --- a/versioned_docs/version-1.x/surrealql/functions/search.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/search.mdx @@ -39,7 +39,7 @@ The `search::score` returns the relevance score corresponding to the given 'matc ```surql title="API DEFINITION" search::score(number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql SELECT id, title, search::score(1) AS score FROM book @@ -65,7 +65,7 @@ The `search::highlight` highlights the matching keywords for the predicate refer ```surql title="API DEFINITION" search::highlight(string, string, number) -> string | string[] ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql SELECT id, search::highlight('', '', 1) AS title @@ -89,7 +89,7 @@ The `search::offsets` returns the position of the matching keywords for the pred ```surql title="API DEFINITION" search::offsets(number) -> object ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql SELECT id, title, search::offsets(1) AS title_offsets diff --git a/versioned_docs/version-1.x/surrealql/functions/session.mdx b/versioned_docs/version-1.x/surrealql/functions/session.mdx index c6d9ae203..a0ff8c081 100644 --- a/versioned_docs/version-1.x/surrealql/functions/session.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/session.mdx @@ -51,7 +51,7 @@ The `session::db` function returns the currently selected database. ```surql title="API DEFINITION" session::db() -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN session::db(); @@ -68,7 +68,7 @@ The `session::db` function returns the currently selected database. ```surql title="API DEFINITION" session::db() -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN session::db(); @@ -85,7 +85,7 @@ The `session::ip` function returns the currently selected database. ```surql title="API DEFINITION" session::ip() -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN session::ip(); @@ -102,7 +102,7 @@ The `session::ns` function returns the currently selected namespace. ```surql title="API DEFINITION" session::ns() -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN session::ns(); @@ -119,7 +119,7 @@ The `session::origin` function returns the current user's HTTP origin. ```surql title="API DEFINITION" session::origin() -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN session::origin(); @@ -136,7 +136,7 @@ The `session::sc` function returns the current user's authentication scope. ```surql title="API DEFINITION" session::sc() -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN session::sc(); diff --git a/versioned_docs/version-1.x/surrealql/functions/sleep.mdx b/versioned_docs/version-1.x/surrealql/functions/sleep.mdx index 938b5f51b..1690d956e 100644 --- a/versioned_docs/version-1.x/surrealql/functions/sleep.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/sleep.mdx @@ -33,7 +33,7 @@ The `sleep` function delays or pauses the execution of a query or a set of state ```surql title="API DEFINITION" sleep(duration) -> none ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN sleep(1s); @@ -43,4 +43,4 @@ RETURN sleep(500ms);
## See also -Alternatively you may want to use the [SLEEP statement](/docs/surrealdb/1.x/surrealql/statements/sleep). \ No newline at end of file +Alternatively you may want to use the [SLEEP statement](/docs/surrealdb/surrealql/statements/sleep). \ No newline at end of file diff --git a/versioned_docs/version-1.x/surrealql/functions/string.mdx b/versioned_docs/version-1.x/surrealql/functions/string.mdx index de8d2c684..7a9d29051 100644 --- a/versioned_docs/version-1.x/surrealql/functions/string.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/string.mdx @@ -183,7 +183,7 @@ The `string::concat` function concatenates strings together. ```surql title="API DEFINITION" string::concat(string...) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::concat('this', ' ', 'is', ' ', 'a', ' ', 'test'); @@ -200,7 +200,7 @@ The `string::contains` function checks whether a string contains another string ```surql title="API DEFINITION" string::contains(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::contains('abcdefg', 'cde'); @@ -217,7 +217,7 @@ The `string::endsWith` function checks whether a string ends with another string ```surql title="API DEFINITION" string::endsWith(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::endsWith('some test', 'test'); @@ -234,7 +234,7 @@ The `string::join` function joins strings together with a delimiter. ```surql title="API DEFINITION" string::join(string, string...) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::join(', ', 'a', 'list', 'of', 'items'); @@ -251,7 +251,7 @@ The `string::len` function returns the length of a given string. ```surql title="API DEFINITION" string::len(string) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::len('this is a test'); @@ -268,7 +268,7 @@ The `string::lowercase` function converts a string to lowercase. ```surql title="API DEFINITION" string::lowercase(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::lowercase('THIS IS A TEST'); @@ -285,7 +285,7 @@ The `string::repeat` function repeats a string a number of times. ```surql title="API DEFINITION" string::repeat(string, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::repeat('test', 3); @@ -302,7 +302,7 @@ The `string::replace` function replaces an occurrence of a string with another ```surql title="API DEFINITION" string::replace(string, string, string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::replace('this is a test', 'a test', 'awesome'); @@ -319,7 +319,7 @@ The `string::reverse` function reverses a string. ```surql title="API DEFINITION" string::reverse(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::reverse('this is a test'); @@ -336,7 +336,7 @@ The `string::slice` function extracts and returns a section of a string. ```surql title="API DEFINITION" string::slice(string, number, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::slice('this is a test', 10, 4); @@ -353,7 +353,7 @@ The `string::slug` function converts a string into a human and URL-friendly str ```surql title="API DEFINITION" string::slug(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::slug('SurrealDB has launched #database #awesome'); @@ -370,7 +370,7 @@ The `string::split` function splits a string by a given delimiter. ```surql title="API DEFINITION" string::split(string, string) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::split('this, is, a, list', ', '); @@ -387,7 +387,7 @@ The `string::startsWith` function checks whether a string starts with another st ```surql title="API DEFINITION" string::startsWith(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::startsWith('some test', 'some'); @@ -404,7 +404,7 @@ The `string::trim` function removes whitespace from the start and end of a strin ```surql title="API DEFINITION" string::trim(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::trim(' this is a test '); @@ -421,7 +421,7 @@ The `string::uppercase` function converts a string to uppercase. ```surql title="API DEFINITION" string::uppercase(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::uppercase('this is a test'); @@ -438,7 +438,7 @@ The `string::words` function splits a string into an array of separate words. ```surql title="API DEFINITION" string::words(string) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::words('this is a test'); @@ -455,7 +455,7 @@ The `string::is::alphanum` function checks whether a value has only alphanumeric ```surql title="API DEFINITION" string::is::alphanum(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::alphanum("ABC123"); @@ -472,7 +472,7 @@ The `string::is::alpha` function checks whether a value has only alpha character ```surql title="API DEFINITION" string::is::alpha(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::alpha("ABCDEF"); @@ -489,7 +489,7 @@ The `string::is::ascii` function checks whether a value has only ascii character ```surql title="API DEFINITION" string::is::ascii(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::ascii("ABC123"); @@ -506,14 +506,14 @@ The `string::is::datetime` function checks whether a string representation of a ```surql title="API DEFINITION" string::is::datetime(string, string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::datetime("2015-09-05 23:56:04", "%Y-%m-%d %H:%M:%S"); true ``` -[View all format options](/docs/surrealdb/1.x/surrealql/datamodel/formatters) +[View all format options](/docs/surrealdb/surrealql/datamodel/formatters)
@@ -524,7 +524,7 @@ The `string::is::domain` function checks whether a value is a domain. ```surql title="API DEFINITION" string::is::domain(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::domain("surrealdb.com"); @@ -541,7 +541,7 @@ The `string::is::email` function checks whether a value is an email. ```surql title="API DEFINITION" string::is::email(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::email("info@surrealdb.com"); @@ -558,7 +558,7 @@ The `string::is::hexadecimal` function checks whether a value is hexadecimal. ```surql title="API DEFINITION" string::is::hexadecimal(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::hexadecimal("ff009e"); @@ -575,7 +575,7 @@ The `string::is::latitude` function checks whether a value is a latitude value. ```surql title="API DEFINITION" string::is::latitude(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::latitude("-0.118092"); @@ -592,7 +592,7 @@ The `string::is::longitude` function checks whether a value is a longitude value ```surql title="API DEFINITION" string::is::longitude(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::longitude("51.509865"); @@ -609,7 +609,7 @@ The `string::is::numeric`function checks whether a value has only numeric charac ```surql title="API DEFINITION" string::is::numeric(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::numeric("1484091748"); @@ -626,7 +626,7 @@ The `string::is::semver` function checks whether a value matches a semver versio ```surql title="API DEFINITION" string::is::semver(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::semver("1.0.0"); @@ -643,7 +643,7 @@ The `string::is::url` function checks whether a value is a valid URL. ```surql title="API DEFINITION" string::is::url(string) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::url("https://surrealdb.com"); @@ -660,7 +660,7 @@ The `string::is::uuid` function checks whether a value is a UUID. ```surql title="API DEFINITION" string::is::uuid(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::is::uuid("018a6680-bef9-701b-9025-e1754f296a0f"); @@ -679,7 +679,7 @@ equal, and `1` indicates the first version is higher than the second. ```surql title="API DEFINITION" string::semver::compare(string, string) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::compare("1.0.0", "1.3.5"); @@ -696,7 +696,7 @@ The `string::semver::major` function extracts the major number out of a semver s ```surql title="API DEFINITION" string::semver::major(string) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::major("3.2.6"); @@ -713,7 +713,7 @@ The `string::semver::minor` function extracts the minor number out of a semver s ```surql title="API DEFINITION" string::semver::minor(string) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::minor("3.2.6"); @@ -730,7 +730,7 @@ The `string::semver::patch` function extracts the patch number out of a semver s ```surql title="API DEFINITION" string::semver::patch(string) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::patch("3.2.6"); @@ -747,7 +747,7 @@ The `string::semver::inc::major` function increments the major number of a semve ```surql title="API DEFINITION" string::semver::inc::major(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::inc::major("1.2.3"); @@ -764,7 +764,7 @@ The `string::semver::inc::minor` function increments the minor number of a semve ```surql title="API DEFINITION" string::semver::inc::minor(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::inc::minor("1.2.3"); @@ -781,7 +781,7 @@ The `string::semver::inc::patch` function increments the patch number of a semve ```surql title="API DEFINITION" string::semver::inc::patch(string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::inc::patch("1.2.3"); @@ -798,7 +798,7 @@ The `string::semver::set::major` function sets the major number of a semver stri ```surql title="API DEFINITION" string::semver::set::major(string, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::set::major("1.2.3", 9); @@ -815,7 +815,7 @@ The `string::semver::set::minor` function sets the minor number of a semver stri ```surql title="API DEFINITION" string::semver::set::minor(string, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::set::minor("1.2.3", 9); @@ -832,7 +832,7 @@ The `string::semver::set::patch` function sets the patch number of a semver stri ```surql title="API DEFINITION" string::semver::set::patch(string, number) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN string::semver::set::patch("1.2.3", 9); diff --git a/versioned_docs/version-1.x/surrealql/functions/time.mdx b/versioned_docs/version-1.x/surrealql/functions/time.mdx index 65f64d514..2a3677ae5 100644 --- a/versioned_docs/version-1.x/surrealql/functions/time.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/time.mdx @@ -120,7 +120,7 @@ The `time::day` function extracts the day as a number from a datetime. ```surql title="API DEFINITION" time::day(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::day("2021-11-01T08:30:17+00:00"); @@ -137,7 +137,7 @@ The `time::floor` function rounds a datetime down by a specific duration. ```surql title="API DEFINITION" time::floor(datetime, duration) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::floor("2021-11-01T08:30:17+00:00", 1w); @@ -154,14 +154,14 @@ The `time::format` function outputs a datetime according to a specific format. ```surql title="API DEFINITION" time::format(datetime, string) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::format("2021-11-01T08:30:17+00:00", "%Y-%m-%d"); "2021-11-01" ``` -[View all format options](/docs/surrealdb/1.x/surrealql/datamodel/formatters) +[View all format options](/docs/surrealdb/surrealql/datamodel/formatters)
@@ -172,7 +172,7 @@ The `time::group` function reduces and rounds a datetime down to a particular ti ```surql title="API DEFINITION" time::group(datetime, string) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::group("2021-11-01T08:30:17+00:00", "year"); @@ -189,7 +189,7 @@ The `time::hour` function extracts the hour as a number from a datetime. ```surql title="API DEFINITION" time::hour(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::hour("2021-11-01T08:30:17+00:00"); @@ -206,7 +206,7 @@ The `time::max` function extracts the maximum as a number from a datetime. ```surql title="API DEFINITION" time::max(array) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::max([ "1987-06-22T08:30:45Z", "1988-06-22T08:30:45Z" ]) @@ -223,7 +223,7 @@ The `time::min` function extracts the minimum as a number from a datetime. ```surql title="API DEFINITION" time::min(array) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::min([ "1987-06-22T08:30:45Z", "1988-06-22T08:30:45Z" ]) @@ -240,7 +240,7 @@ The `time::minute` function extracts the minutes as a number from a datetime. ```surql title="API DEFINITION" time::minute(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::minute("2021-11-01T08:30:17+00:00"); @@ -257,7 +257,7 @@ The `time::month` function extracts the month as a number from a datetime. ```surql title="API DEFINITION" time::minute(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::month("2021-11-01T08:30:17+00:00"); @@ -274,7 +274,7 @@ The `time::nano`function returns a datetime as an integer representing the numbe ```surql title="API DEFINITION" time::nano(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::nano("2021-11-01T08:30:17+00:00"); @@ -301,7 +301,7 @@ The `time::round` function rounds a datetime up by a specific duration. ```surql title="API DEFINITION" time::round(datetime, duration) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::round("2021-11-01T08:30:17+00:00", 1w); @@ -318,7 +318,7 @@ The `time::second` function extracts the second as a number from a datetime. ```surql title="API DEFINITION" time::second(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::second("2021-11-01T08:30:17+00:00"); @@ -345,7 +345,7 @@ The `time::unix` function returns a datetime as an integer representing the numb ```surql title="API DEFINITION" time::unix(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::unix("2021-11-01T08:30:17+00:00"); @@ -362,7 +362,7 @@ The `time::wday` function extracts the week day as a number from a datetime. ```surql title="API DEFINITION" time::wday(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::wday("2021-11-01T08:30:17+00:00"); @@ -379,7 +379,7 @@ The `time::week` function extracts the week as a number from a datetime. ```surql title="API DEFINITION" time::week(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::week("2021-11-01T08:30:17+00:00"); @@ -396,7 +396,7 @@ The `time::yday` function extracts the yday as a number from a datetime. ```surql title="API DEFINITION" time::yday(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::yday("2021-11-01T08:30:17+00:00"); @@ -413,7 +413,7 @@ The `time::year` function extracts the year as a number from a datetime. ```surql title="API DEFINITION" time::year(datetime) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::year("2021-11-01T08:30:17+00:00"); @@ -430,7 +430,7 @@ The `time::from::micros` function calculates a datetime based on an amount of mi ```surql title="API DEFINITION" time::from::micros(number) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::from::micros(1000000); @@ -447,7 +447,7 @@ The `time::from::millis` function calculates a datetime based on an amount of mi ```surql title="API DEFINITION" time::from::millis(number) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::from::millis(1000); @@ -464,7 +464,7 @@ The `time::from::secs`function calculates a datetime based on an amount of secon ```surql title="API DEFINITION" time::from::secs(number) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::from::secs(1000); @@ -481,7 +481,7 @@ The `time::from::secs`function calculates a datetime based on an amount of secon ```surql title="API DEFINITION" time::from::unix(number) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN time::from::unix(1000); diff --git a/versioned_docs/version-1.x/surrealql/functions/type.mdx b/versioned_docs/version-1.x/surrealql/functions/type.mdx index e8d1ac6db..e6a87cd3b 100644 --- a/versioned_docs/version-1.x/surrealql/functions/type.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/type.mdx @@ -171,7 +171,7 @@ The ` type::bool` function returns a boolean value. ```surql title="API DEFINITION" type::bool(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::bool("true"); @@ -179,7 +179,7 @@ RETURN type::bool("true"); true ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#bool) to cast a value to a boolean. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#bool) to cast a value to a boolean.
@@ -190,7 +190,7 @@ The ` type::datetime` function converts a value into a datetime. ```surql title="API DEFINITION" type::datetime(any) -> datetime ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::datetime("2022-04-27T18:12:27+00:00"); @@ -198,7 +198,7 @@ RETURN type::datetime("2022-04-27T18:12:27+00:00"); "2022-04-27T18:12:27Z" ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#datetime) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#datetime) to cast a value to a datetime.
@@ -209,7 +209,7 @@ The ` type::decimal` function converts a value into a decimal. ```surql title="API DEFINITION" type::decimal(any) -> decimal ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::decimal("12345"); @@ -217,7 +217,7 @@ RETURN type::decimal("12345"); 12345.00 ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#decimal) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#decimal) to cast a value to a datetime.
@@ -228,7 +228,7 @@ The ` type::duration` function converts a value into a duration. ```surql title="API DEFINITION" type::duration(any) -> duration ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::duration("4h"); @@ -236,7 +236,7 @@ RETURN type::duration("4h"); 4h ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#duration) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#duration) to cast a value to a datetime.
@@ -317,14 +317,14 @@ The `type::float` function converts a value into a float. ```surql title="API DEFINITION" type::float(any) -> float ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::float("12345"); 12345.0 ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#float) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#float) to cast a value to a datetime.
@@ -335,14 +335,14 @@ The `type::int` function converts a value into an integer. ```surql title="API DEFINITION" type::int(any) -> int ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::int("12345"); 12345 ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#int) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#int) to cast a value to a datetime.
@@ -353,14 +353,14 @@ The `type::number` function converts a value into a number. ```surql title="API DEFINITION" type::number(any) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::number("12345"); 12345 ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#number) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#number) to cast a value to a datetime.
@@ -371,7 +371,7 @@ The `type::point` function converts a value into a geometry point. ```surql title="API DEFINITION" type::point(any) -> point ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::point([ 51.509865, -0.118092 ]); @@ -394,14 +394,14 @@ The `type::string` function converts a value into a string. ```surql title="API DEFINITION" type::string(any) -> string ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::string(12345); "12345" ``` -This is the equivalent of using [``](/docs/surrealdb/1.x/surrealql/datamodel/casting#string) to cast a value to a datetime. +This is the equivalent of using [``](/docs/surrealdb/surrealql/datamodel/casting#string) to cast a value to a datetime.
@@ -412,7 +412,7 @@ The `type::table` function converts a value into a string. ```surql title="API DEFINITION" type::table(any) -> table ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql LET $table = "person"; @@ -429,7 +429,7 @@ The `type::thing` function converts a value into a record pointer definition. ```surql title="API DEFINITION" type::thing(any, any) -> thing ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql LET $tb = "person"; @@ -446,7 +446,7 @@ The `type::is::array` function checks if the passed value is of type `array`. ```surql title="API DEFINITION" type::is::array(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::array([ 'a', 'b', 'c' ]); @@ -463,7 +463,7 @@ The `type::is::bool` function checks if the passed value is of type `bool`. ```surql title="API DEFINITION" type::is::bool(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::bool(true); @@ -480,7 +480,7 @@ The `type::is::bytes` function checks if the passed value is of type `bytes`. ```surql title="API DEFINITION" type::is::bytes(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::bytes("I am not bytes"); @@ -497,7 +497,7 @@ The `type::is::collection` function checks if the passed value is of type `colle ```surql title="API DEFINITION" type::is::collection(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::collection("I am not a collection"); @@ -514,7 +514,7 @@ The `type::is::datetime` function checks if the passed value is of type `datetim ```surql title="API DEFINITION" type::is::datetime(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::datetime(time::now()); @@ -531,7 +531,7 @@ The `type::is::decimal` function checks if the passed value is of type `decimal` ```surql title="API DEFINITION" type::is::decimal(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::decimal( 13.5719384719384719385639856394139476937756394756); @@ -548,7 +548,7 @@ The `type::is::duration` function checks if the passed value is of type `duratio ```surql title="API DEFINITION" type::is::duration(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::duration('1970-01-01T00:00:00'); @@ -565,7 +565,7 @@ The `type::is::float` function checks if the passed value is of type `float`. ```surql title="API DEFINITION" type::is::float(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::float( 41.5); @@ -582,7 +582,7 @@ The `type::is::geometry` function checks if the passed value is of type `geometr ```surql title="API DEFINITION" type::is::geometry(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::geometry((-0.118092, 51.509865)); @@ -599,7 +599,7 @@ The `type::is::int` function checks if the passed value is of type `int`. ```surql title="API DEFINITION" type::is::int(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::int( 123); @@ -616,7 +616,7 @@ The `type::is::line` function checks if the passed value is of type `line`. ```surql title="API DEFINITION" type::is::line(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::line("I am not a line"); @@ -633,7 +633,7 @@ The `type::is::none` function checks if the passed value is of type `none`. ```surql title="API DEFINITION" type::is::none(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::none(NONE); @@ -650,7 +650,7 @@ The `type::is::null` function checks if the passed value is of type `null`. ```surql title="API DEFINITION" type::is::null(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::null(NULL); @@ -667,7 +667,7 @@ The `type::is::multiline` function checks if the passed value is of type `multil ```surql title="API DEFINITION" type::is::multiline(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::multiline("I am not a multiline"); @@ -684,7 +684,7 @@ The `type::is::multipoint` function checks if the passed value is of type `multi ```surql title="API DEFINITION" type::is::multipoint(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::multipoint("I am not a multipoint"); @@ -701,7 +701,7 @@ The `type::is::multipolygon` function checks if the passed value is of type `mul ```surql title="API DEFINITION" type::is::multipolygon(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::multipolygon("I am not a multipolygon"); @@ -718,7 +718,7 @@ The `type::is::number` function checks if the passed value is of type `number`. ```surql title="API DEFINITION" type::is::number(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::number(123); @@ -735,7 +735,7 @@ The `type::is::object` function checks if the passed value is of type `object`. ```surql title="API DEFINITION" type::is::object(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::object({ hello: 'world' }); @@ -752,7 +752,7 @@ The `type::is::point` function checks if the passed value is of type `point`. ```surql title="API DEFINITION" type::is::point(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::point((-0.118092, 51.509865)); @@ -769,7 +769,7 @@ The `type::is::polygon` function checks if the passed value is of type `polygon` ```surql title="API DEFINITION" type::is::polygon(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::polygon("I am not a polygon"); @@ -786,7 +786,7 @@ The `type::is::record` function checks if the passed value is of type `record` ```surql title="API DEFINITION" type::is::record(any, any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::record(user:tobie); @@ -812,7 +812,7 @@ The `type::is::string` function checks if the passed value is of type `string`. ```surql title="API DEFINITION" type::is::string(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::string("abc"); @@ -829,7 +829,7 @@ The `type::is::uuid` function checks if the passed value is of type `uuid`. ```surql title="API DEFINITION" type::is::uuid(any) -> bool ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN type::is::uuid("018a6680-bef9-701b-9025-e1754f296a0f"); diff --git a/versioned_docs/version-1.x/surrealql/functions/vector.mdx b/versioned_docs/version-1.x/surrealql/functions/vector.mdx index 957674e96..f4490b34e 100644 --- a/versioned_docs/version-1.x/surrealql/functions/vector.mdx +++ b/versioned_docs/version-1.x/surrealql/functions/vector.mdx @@ -99,7 +99,7 @@ The `vector::add` function performs element-wise addition of two vectors, where ```surql title="API DEFINITION" vector::add(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::add([1, 2, 3], [1, 2, 3]); @@ -116,7 +116,7 @@ The `vector::angle` function computes the angle between two vectors, providing a ```surql title="API DEFINITION" vector::angle(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::angle([5, 10, 15], [10, 5, 20]); @@ -133,7 +133,7 @@ The `vector::cross` function computes the cross product of two vectors, which re ```surql title="API DEFINITION" vector::cross(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::cross([1, 2, 3], [4, 5, 6]); @@ -151,7 +151,7 @@ The `vector::divide` function performs element-wise division between two vectors vector::divide(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::divide([10, -20, 30, 0], [0, -1, 2, -3]); @@ -169,7 +169,7 @@ The `vector::dot` function computes the dot product of two vectors, which is the vector::dot(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::dot([1, 2, 3], [1, 2, 3]); @@ -187,7 +187,7 @@ The `vector::magnitude` function computes the magnitude (or length) of a vector, vector::magnitude(array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::magnitude([ 1, 2, 3, 3, 3, 4, 5 ]); @@ -205,7 +205,7 @@ The `vector::multiply` function performs element-wise multiplication of two vect vector::multiply(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::multiply([1, 2, 3], [1, 2, 3]); @@ -223,7 +223,7 @@ The `vector::normalize` function computes the normalization of a vector, transfo vector::normalize(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::normalize([ 4, 3 ]); @@ -241,7 +241,7 @@ The `vector::project` function computes the normalization of a vector, transform vector::project(array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::project([1, 2, 3], [4, 5, 6]); @@ -259,7 +259,7 @@ The `vector::subtract` function performs element-wise subtraction between two ve vector::subtract(array, array) -> array ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::subtract([4, 5, 6], [3, 2, 1]); @@ -277,7 +277,7 @@ The `vector::distance::chebyshev` function computes the Chebyshev distance (also vector::distance::chebyshev(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::distance::chebyshev([2, 4, 5, 3, 8, 2], [3, 1, 5, -3, 7, 2]); @@ -295,7 +295,7 @@ The `vector::distance::euclidean` function computes the Euclidean distance betwe vector::distance::euclidean(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::distance::euclidean([10, 50, 200], [400, 100, 20]); @@ -313,7 +313,7 @@ The `vector::distance::hamming` function computes the Hamming distance between t vector::distance::hamming(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::distance::hamming([1, 2, 2], [1, 2, 3]); @@ -331,7 +331,7 @@ The `vector::distance::manhattan` function computes the Manhattan distance (als vector::distance::manhattan(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::distance::manhattan([10, 20, 15, 10, 5], [12, 24, 18, 8, 7]); @@ -350,7 +350,7 @@ The `vector::distance::minkowski` function computes the Minkowski distance betwe vector::distance::minkowski(array, array, number) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::distance::minkowski([10, 20, 15, 10, 5], [12, 24, 18, 8, 7], 3); @@ -369,7 +369,7 @@ The `vector::distance::cosine` function computes the Cosine similarity between t vector::similarity::cosine(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::similarity::cosine([10, 50, 200], [400, 100, 20]); @@ -388,7 +388,7 @@ The `vector::distance::jaccard` function computes the Jaccard similarity between vector::similarity::jaccard(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::similarity::jaccard([0,1,2,5,6], [0,2,3,4,5,7,9]); @@ -407,7 +407,7 @@ The `vector::distance::pearson` function Computes the Pearson correlation coeffi vector::similarity::pearson(array, array) -> number ``` -The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) statement: +The following example shows this function, and its output, when used in a [`RETURN`](/docs/surrealdb/surrealql/statements/return) statement: ```surql RETURN vector::similarity::pearson([1,2,3], [1,5,7]); diff --git a/versioned_docs/version-1.x/surrealql/index.mdx b/versioned_docs/version-1.x/surrealql/index.mdx index 1c41f5a48..96ef1d339 100644 --- a/versioned_docs/version-1.x/surrealql/index.mdx +++ b/versioned_docs/version-1.x/surrealql/index.mdx @@ -44,6 +44,6 @@ SurrealQL offers several key features that make it a powerful tool for working w ## Getting Started -To start using [SurrealQL](/docs/surrealdb/1.x/surrealql/statements/begin), refer to the documentation on the various statement types and their syntax. The statements page provides comprehensive examples and explanations for each statement type, helping you understand how to construct queries and interact with SurrealDB effectively. +To start using [SurrealQL](/docs/surrealdb/surrealql/statements/begin), refer to the documentation on the various statement types and their syntax. The statements page provides comprehensive examples and explanations for each statement type, helping you understand how to construct queries and interact with SurrealDB effectively. We hope that SurrealQL empowers you to leverage the full potential of SurrealDB and enables you to build robust and scalable applications. Let's dive into the world of SurrealQL and unlock the capabilities of SurrealDB together! \ No newline at end of file diff --git a/versioned_docs/version-1.x/surrealql/statements/begin.mdx b/versioned_docs/version-1.x/surrealql/statements/begin.mdx index 8e1a651be..5a8961aa0 100644 --- a/versioned_docs/version-1.x/surrealql/statements/begin.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/begin.mdx @@ -9,7 +9,7 @@ description: The BEGIN statement can be used to run a group of statements togeth Each statement within SurrealDB is run within its own transaction. If a set of changes need to be made together, then groups of statements can be run together as a single transaction, either succeeding as a whole, or failing without leaving any residual data modifications. -The `BEGIN` statement can be used to run a group of statements together, either succeeding as a whole, or failing. If all of the statements within a transaction succeed, and the transaction is successful, then all of the data modifications made during the transaction are committed ([COMMIT](/docs/surrealdb/1.x/surrealql/statements/commit)) and become a permanent part of the database. If a transaction encounters errors and must be cancelled or rolled back ([CANCEL](/docs/surrealdb/1.x/surrealql/statements/cancel)), then any data modification made within the transaction is rolledback, and will not be visible within the database. +The `BEGIN` statement can be used to run a group of statements together, either succeeding as a whole, or failing. If all of the statements within a transaction succeed, and the transaction is successful, then all of the data modifications made during the transaction are committed ([COMMIT](/docs/surrealdb/surrealql/statements/commit)) and become a permanent part of the database. If a transaction encounters errors and must be cancelled or rolled back ([CANCEL](/docs/surrealdb/surrealql/statements/cancel)), then any data modification made within the transaction is rolledback, and will not be visible within the database. ### Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/break.mdx b/versioned_docs/version-1.x/surrealql/statements/break.mdx index 2e9855d13..b26261f20 100644 --- a/versioned_docs/version-1.x/surrealql/statements/break.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/break.mdx @@ -7,7 +7,7 @@ description: The BREAK statement can be used to break out of a loop, like within # `BREAK` statement -The BREAK statement can be used to break out of a loop, like within the [FOR statement](/docs/surrealdb/1.x/surrealql/statements/for). +The BREAK statement can be used to break out of a loop, like within the [FOR statement](/docs/surrealdb/surrealql/statements/for). ### Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/continue.mdx b/versioned_docs/version-1.x/surrealql/statements/continue.mdx index c2dd3f0d8..53a554b3e 100644 --- a/versioned_docs/version-1.x/surrealql/statements/continue.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/continue.mdx @@ -7,7 +7,7 @@ description: The CONTINUE statement can be used to skip an iteration of a loop, # `CONTINUE` statement -The CONTINUE statement can be used to skip an iteration of a loop, like within the [FOR statement](/docs/surrealdb/1.x/surrealql/statements/for). +The CONTINUE statement can be used to skip an iteration of a loop, like within the [FOR statement](/docs/surrealdb/surrealql/statements/for). ### Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/create.mdx b/versioned_docs/version-1.x/surrealql/statements/create.mdx index 1f1ecfd99..4c446f959 100644 --- a/versioned_docs/version-1.x/surrealql/statements/create.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/create.mdx @@ -10,7 +10,7 @@ description: The CREATE statement can be used to add a record to the database. I The `CREATE` statement can be used to add a record to the database. If the record already exists, the statement will give an error. :::note -__Note:__ This statement can not be used to create graph relationships. For that, use the [`RELATE`](/docs/surrealdb/1.x/surrealql/statements/relate) statement. +__Note:__ This statement can not be used to create graph relationships. For that, use the [`RELATE`](/docs/surrealdb/surrealql/statements/relate) statement. ::: ### Statement syntax @@ -28,10 +28,10 @@ CREATE [ ONLY ] @targets ## Creating a Table Record -When using the create statement the first word after `CREATE` is the table name. You also specify a record identifier using the `:` followed by a value. Ex. `CREATE Table:this`. The two together form the full [record ID](/docs/surrealdb/1.x/surrealql/datamodel/ids) which can be used to query the created data or by using the [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/select) statement. See the [record ID](/docs/surrealdb/1.x/surrealql/datamodel/ids) page to learn more about what counts as a valid record identifier. If no record identifier is specified, a random identifier will be generated. +When using the create statement the first word after `CREATE` is the table name. You also specify a record identifier using the `:` followed by a value. Ex. `CREATE Table:this`. The two together form the full [record ID](/docs/surrealdb/surrealql/datamodel/ids) which can be used to query the created data or by using the [`SELECT`](/docs/surrealdb/surrealql/statements/select) statement. See the [record ID](/docs/surrealdb/surrealql/datamodel/ids) page to learn more about what counts as a valid record identifier. If no record identifier is specified, a random identifier will be generated. :::note -__Note:__ You can also assign the recordID to be [randomly generated](/docs/surrealdb/1.x/surrealql/datamodel/ids#generating-record-ids) +__Note:__ You can also assign the recordID to be [randomly generated](/docs/surrealdb/surrealql/datamodel/ids#generating-record-ids) ::: The query below will create a new person table and also create a new record with a random ID. @@ -66,7 +66,7 @@ The above will create a new record with the ID `person:100`. ] ``` -It is also possible to specify the ID of the record you want to create using a string or any of the supported formats for [record IDs](/docs/surrealdb/1.x/surrealql/datamodel/ids). +It is also possible to specify the ID of the record you want to create using a string or any of the supported formats for [record IDs](/docs/surrealdb/surrealql/datamodel/ids). @@ -160,10 +160,10 @@ CREATE person:26, CREATE person:27 PARALLEL; ## Learn more To learn more about SurrealDB, check out the following resources: -- [Getting started guide](/docs/surrealdb/1.x/introduction/start) -- [Select statement](/docs/surrealdb/1.x/surrealql/statements/select) -- [Update statement](/docs/surrealdb/1.x/surrealql/statements/update) -- [Insert statement](/docs/surrealdb/1.x/surrealql/statements/insert) -- [Delete statement](/docs/surrealdb/1.x/surrealql/statements/delete) -- [Relate statement](/docs/surrealdb/1.x/surrealql/statements/relate) +- [Getting started guide](/docs/surrealdb/introduction/start) +- [Select statement](/docs/surrealdb/surrealql/statements/select) +- [Update statement](/docs/surrealdb/surrealql/statements/update) +- [Insert statement](/docs/surrealdb/surrealql/statements/insert) +- [Delete statement](/docs/surrealdb/surrealql/statements/delete) +- [Relate statement](/docs/surrealdb/surrealql/statements/relate) diff --git a/versioned_docs/version-1.x/surrealql/statements/define/analyzer.mdx b/versioned_docs/version-1.x/surrealql/statements/define/analyzer.mdx index 2f8c8437b..ebd20cc40 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/analyzer.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/analyzer.mdx @@ -11,7 +11,7 @@ In the context of a database, an analyzer plays a crucial role in text processin ## Requirements - You must be authenticated as a root, namespace, or database user before you can use the `DEFINE ANALYZER` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE ANALYZER` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE ANALYZER` statement. ## Statement syntax @@ -139,7 +139,7 @@ DEFINE ANALYZER IF NOT EXISTS example TOKENIZERS blank; ## More examples -Examples on application of analyzers to indexes can be found in the documenation on [`DEFINE INDEX`](/docs/surrealdb/1.x/surrealql/statements/define/indexes) statement +Examples on application of analyzers to indexes can be found in the documenation on [`DEFINE INDEX`](/docs/surrealdb/surrealql/statements/define/indexes) statement This example creates an analyzer that tokenizes text based on the class of characters and then applies the lowercase filter to the tokens. diff --git a/versioned_docs/version-1.x/surrealql/statements/define/database.mdx b/versioned_docs/version-1.x/surrealql/statements/define/database.mdx index d9c785c0a..f1144cecc 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/database.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/database.mdx @@ -12,7 +12,7 @@ The `DEFINE DATABASE` statement allows you to instantiate a named database, enab ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE DATABASE` statement. -- [You must select your namespace](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE DATABASE` statement. +- [You must select your namespace](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE DATABASE` statement. ## Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/define/event.mdx b/versioned_docs/version-1.x/surrealql/statements/define/event.mdx index be4187632..c8dc36f84 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/event.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/event.mdx @@ -12,7 +12,7 @@ Events can be triggered after any change or modification to the data in a record ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE EVENT` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE EVENT` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE EVENT` statement. ## Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/define/field.mdx b/versioned_docs/version-1.x/surrealql/statements/define/field.mdx index b4cc09585..f765d9cf8 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/field.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/field.mdx @@ -12,7 +12,7 @@ The `DEFINE FIELD` statement allows you to instantiate a named field on a table, ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE FIELD` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE FIELD` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE FIELD` statement. ## Statement syntax @@ -41,7 +41,7 @@ DEFINE FIELD email ON TABLE user; ``` ## Defining data types -The `DEFINE FIELD` statement allows you to set the data type of a field. For a full list of supported data types, see [Data types](/docs/surrealdb/1.x/surrealql/datamodel). +The `DEFINE FIELD` statement allows you to set the data type of a field. For a full list of supported data types, see [Data types](/docs/surrealdb/surrealql/datamodel). ### Simple data types ```surql @@ -93,7 +93,7 @@ You can make a field optional by wrapping the inner type in an `option`, which a DEFINE FIELD biography ON TABLE user TYPE option; ``` -The example below shows how to define a field `user` on a `POST` table. The field is of type [record](/docs/surrealdb/1.x/surrealql/datamodel/records). This means that the field can store a `record` or `NONE`. +The example below shows how to define a field `user` on a `POST` table. The field is of type [record](/docs/surrealdb/surrealql/datamodel/records). This means that the field can store a `record` or `NONE`. ```surql DEFINE FIELD user ON TABLE POST TYPE option>; @@ -121,7 +121,7 @@ DEFINE FIELD updated ON resource VALUE time::now(); ### Alter a passed value You can alter a passed value using the `VALUE` clause. This is useful for altering the value of a field before it is stored in the database. -In the example below, the `VALUE` clause is used to ensure that the email address is always stored in lowercase characters by using the [`string::lowercase`](/docs/surrealdb/1.x/surrealql/functions/string#stringlowercase) function. +In the example below, the `VALUE` clause is used to ensure that the email address is always stored in lowercase characters by using the [`string::lowercase`](/docs/surrealdb/surrealql/functions/string#stringlowercase) function. ```surql -- Ensure that an email address is always stored in lowercase characters diff --git a/versioned_docs/version-1.x/surrealql/statements/define/function.mdx b/versioned_docs/version-1.x/surrealql/statements/define/function.mdx index 8eb677f4a..045a8212e 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/function.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/function.mdx @@ -12,7 +12,7 @@ The `DEFINE FUNCTION` statement allows you to define custom functions that can b ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE FUNCTION` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE FUNCTION` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE FUNCTION` statement. ## Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/define/indexes.mdx b/versioned_docs/version-1.x/surrealql/statements/define/indexes.mdx index df2a9fc7d..8fa0c3f60 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/indexes.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/indexes.mdx @@ -12,7 +12,7 @@ Just like in other databases, SurrealDB uses indexes to help optimize query perf ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE INDEX` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE INDEX` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE INDEX` statement. ## Statement syntax @@ -34,7 +34,7 @@ Let's create a unique index for the email address field on a user table. DEFINE INDEX userEmailIndex ON TABLE user COLUMNS email UNIQUE; ``` -The created index can be tested using the [`INFO` statement](/docs/surrealdb/1.x/surrealql/statements/info/). +The created index can be tested using the [`INFO` statement](/docs/surrealdb/surrealql/statements/info/). ```surql INFO FOR TABLE user; ``` @@ -117,7 +117,7 @@ DEFINE INDEX test ON user FIELDS account, email; Enables efficient searching through textual data, supporting advanced text-matching features like proximity searches and keyword highlighting. -The [Full-Text search](/docs/surrealdb/1.x/reference-guide/full-text-search) index helps implement comprehensive search functionalities in applications, such as searching through articles, product descriptions, and user-generated content. +The [Full-Text search](/docs/surrealdb/reference-guide/full-text-search) index helps implement comprehensive search functionalities in applications, such as searching through articles, product descriptions, and user-generated content. Let's create a full-text search index for a name field on a user table. @@ -128,7 +128,7 @@ DEFINE INDEX userNameIndex ON TABLE user COLUMNS name SEARCH ANALYZER ascii BM25 ## Verifying Index Utilization in Queries -The [`EXPLAIN` clause](/docs/surrealdb/1.x/surrealql/statements/select#the-explain-clause) from SurrealQL helps you understand the execution plan of the query and provides transparency around index utilization. +The [`EXPLAIN` clause](/docs/surrealdb/surrealql/statements/select#the-explain-clause) from SurrealQL helps you understand the execution plan of the query and provides transparency around index utilization. ```surql SELECT * FROM user WHERE email='test@surrealdb.com' EXPLAIN FULL; @@ -172,6 +172,6 @@ DEFINE INDEX IF NOT EXISTS example ON example FIELDS example; When defining indexes, it's essential to consider the fields most frequently queried or used to optimize performance. -Indexes may improve the performance of SurrealQL statements. This may not be noticeable with small tables but it can be significant for large tables; especially when the indexed fields are used in the `WHERE` clause of a [`SELECT`](/docs/surrealdb/1.x/surrealql/statements/insert/) statement. +Indexes may improve the performance of SurrealQL statements. This may not be noticeable with small tables but it can be significant for large tables; especially when the indexed fields are used in the `WHERE` clause of a [`SELECT`](/docs/surrealdb/surrealql/statements/insert/) statement. -Indexes can also impact the performance of write operations ([INSERT](/docs/surrealdb/1.x/surrealql/statements/insert/), [UPDATE](/docs/surrealdb/1.x/surrealql/statements/update), [DELETE](/docs/surrealdb/1.x/surrealql/statements/delete)) since the index needs to be updated accordingly. Therefore, it's essential to balance the need for read performance with write performance. \ No newline at end of file +Indexes can also impact the performance of write operations ([INSERT](/docs/surrealdb/surrealql/statements/insert/), [UPDATE](/docs/surrealdb/surrealql/statements/update), [DELETE](/docs/surrealdb/surrealql/statements/delete)) since the index needs to be updated accordingly. Therefore, it's essential to balance the need for read performance with write performance. \ No newline at end of file diff --git a/versioned_docs/version-1.x/surrealql/statements/define/param.mdx b/versioned_docs/version-1.x/surrealql/statements/define/param.mdx index c7bd73ef9..b91009cc2 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/param.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/param.mdx @@ -12,7 +12,7 @@ The `DEFINE PARAM` statement allows you to define global (database-wide) paramet ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE PARAM` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE PARAM` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE PARAM` statement. ## Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/define/scope.mdx b/versioned_docs/version-1.x/surrealql/statements/define/scope.mdx index 524f491f9..e921b52be 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/scope.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/scope.mdx @@ -12,7 +12,7 @@ Setting scope access allows SurrealDB to operate as a web database. With scopes ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE SCOPE` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE SCOPE` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE SCOPE` statement. ## Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/define/table.mdx b/versioned_docs/version-1.x/surrealql/statements/define/table.mdx index 0b5bce500..2609f0eaf 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/table.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/table.mdx @@ -12,7 +12,7 @@ The `DEFINE TABLE` statement allows you to declare your table by name, enabling ## Requirements - You must be authenticated as a root or namespace user before you can use the `DEFINE TABLE` statement. -- [You must select your namespace and database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE TABLE` statement. +- [You must select your namespace and database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE TABLE` statement. ## Statement syntax @@ -68,7 +68,7 @@ DEFINE TABLE IF NOT EXISTS reading ### Schemafull tables -The following example demonstrates the `SCHEMAFULL` portion of the `DEFINE TABLE` statement. When a table is defined as schemafull, the database strictly enforces any schema definitions that are specified using the `DEFINE TABLE` statement. New fields can not be added to a `SCHEMAFULL` table unless they are defined via the [`DEFINE FIELD`](/docs/surrealdb/1.x/surrealql/statements/define/field) statement. +The following example demonstrates the `SCHEMAFULL` portion of the `DEFINE TABLE` statement. When a table is defined as schemafull, the database strictly enforces any schema definitions that are specified using the `DEFINE TABLE` statement. New fields can not be added to a `SCHEMAFULL` table unless they are defined via the [`DEFINE FIELD`](/docs/surrealdb/surrealql/statements/define/field) statement. ```surql -- Create schemafull user table. diff --git a/versioned_docs/version-1.x/surrealql/statements/define/token.mdx b/versioned_docs/version-1.x/surrealql/statements/define/token.mdx index 600f102dd..27d53d913 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/token.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/token.mdx @@ -9,7 +9,7 @@ description: SurrealDB can work with third-party authentication providers such a SurrealDB can work with third-party authentication providers such as OpenID Connect providers, OAuth providers and other trusted parties providing JWT (JSON Web Tokens, also refered to in this page as “tokens”). Let's say that your provider issues your client (e.g. a user or a service) a JWT once it has authenticated. By using the DEFINE TOKEN statement, you can set the public key or shared secret that will be used to verify the authenticity of the token. -This verification is performed automatically by SurrealDB when provided with a JWT through any of its interfaces (i.e. the [HTTP REST API](/docs/surrealdb/1.x/integration/http) through the “Authorization” header or [any of the SDKs](/docs/surrealdb/1.x/integration/sdks) through the “Authenticate” methods) before trusting the claims contained in the token and allowing SurrealQL queries to access the values of those claims. +This verification is performed automatically by SurrealDB when provided with a JWT through any of its interfaces (i.e. the [HTTP REST API](/docs/surrealdb/integration/http) through the “Authorization” header or [any of the SDKs](/docs/surrealdb/integration/sdks) through the “Authenticate” methods) before trusting the claims contained in the token and allowing SurrealQL queries to access the values of those claims. ```surql title="SurrealQL Syntax" DEFINE TOKEN [ IF NOT EXISTS ] @name ON [ NAMESPACE | DATABASE | SCOPE @scope ] TYPE @type VALUE @value @@ -73,7 +73,7 @@ iCTjhbIDEBHySSSc/pQ4ftHQmhToTlQeOdEy4LYiaEIgl1X+hzRH1hBYvWlNKe4EY1nMCKcjgt0= ### JSON Web Key Set (JWKS) Since 1.2.0 -With JWKS, a set of JWK (JSON Web Key) objects will be dynamically fetched from a remote location and used to verify tokens following the [RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517) specification. When defining a JWKS token verification method, its value should contain a valid URL that is reachable by SurrealDB and allowed by the configured network [capabilities](/docs/surrealdb/1.x/security/capabilities). This URL should point to a valid JWKS object (as described in [Section 5 of RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517#section-5)) in the form of a JSON document. This is the recommended method to integrate with authentication providers that support JWKS. Providers like [Google](https://developers.google.com/identity/openid-connect/openid-connect#discovery), [AWS Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html#amazon-cognito-user-pools-using-tokens-manually-inspect), [Azure Active Directory](https://azure.github.io/azure-workload-identity/docs/installation/self-managed-clusters/oidc-issuer/jwks.html), [Auth0](https://auth0.com/docs/secure/tokens/json-web-tokens/json-web-key-sets), [Keycloak](https://documentation.cloud-iam.com/how-to-guides/configure-remote-jkws.html) or [OneLogin](https://developers.onelogin.com/authentication/tools/jwt) provide JWKS endpoints to verify tokens issued by their services. +With JWKS, a set of JWK (JSON Web Key) objects will be dynamically fetched from a remote location and used to verify tokens following the [RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517) specification. When defining a JWKS token verification method, its value should contain a valid URL that is reachable by SurrealDB and allowed by the configured network [capabilities](/docs/surrealdb/security/capabilities). This URL should point to a valid JWKS object (as described in [Section 5 of RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517#section-5)) in the form of a JSON document. This is the recommended method to integrate with authentication providers that support JWKS. Providers like [Google](https://developers.google.com/identity/openid-connect/openid-connect#discovery), [AWS Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html#amazon-cognito-user-pools-using-tokens-manually-inspect), [Azure Active Directory](https://azure.github.io/azure-workload-identity/docs/installation/self-managed-clusters/oidc-issuer/jwks.html), [Auth0](https://auth0.com/docs/secure/tokens/json-web-tokens/json-web-key-sets), [Keycloak](https://documentation.cloud-iam.com/how-to-guides/configure-remote-jkws.html) or [OneLogin](https://developers.onelogin.com/authentication/tools/jwt) provide JWKS endpoints to verify tokens issued by their services. The following example shows the definition of a token using a JWKS. @@ -101,7 +101,7 @@ To avoid performing requests to the remote URL for each token that is verified, - To `DEFINE TOKEN ... ON NAMESPACE ...` you must have root or namespace level access. - To `DEFINE TOKEN ... ON DATABASE ...` you must have root, namespace, or database level access. - To `DEFINE TOKEN ... ON SCOPE ...` you must have root, namespace, or database level access. -- [You must select your namespace and/or database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE DATABASE` statement for database or namespace tokens. +- [You must select your namespace and/or database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE DATABASE` statement for database or namespace tokens. ## Using `IF NOT EXISTS` clause Since 1.3.0 @@ -137,7 +137,7 @@ The expected claims depend on the level at which the token was defined: - For tokens defined `ON DATABASE`: `exp`, `tk`,`ns`,`db`. - For tokens defined `ON SCOPE`: `exp`, `tk`, `ns`,`db`, `sc`, optionally `id`. -For tokens defined `ON NAMESPACE` and `ON DATABASE`, the optional `rl` claim containing an array of capitalized [system user roles](/docs/surrealdb/1.x/surrealql/statements/define/user#roles) (e.g. `["Viewer", "Editor", "Owner"]`) can be provided. Doing so will apply the access policy for those roles to any action made using the token. By default, tokens without the `rl` claim will only have the `Viewer` role. +For tokens defined `ON NAMESPACE` and `ON DATABASE`, the optional `rl` claim containing an array of capitalized [system user roles](/docs/surrealdb/surrealql/statements/define/user#roles) (e.g. `["Viewer", "Editor", "Owner"]`) can be provided. Doing so will apply the access policy for those roles to any action made using the token. By default, tokens without the `rl` claim will only have the `Viewer` role. When calling any of the SurrealDB interfaces using a JWT, SurrealQL queries will gain access to the claims in the token through the `$token` variable. For example, if the token contains custom claims such as “name” or “email”, the values of those claims will be accessible through `$token.name` and `$token.email`. diff --git a/versioned_docs/version-1.x/surrealql/statements/define/user.mdx b/versioned_docs/version-1.x/surrealql/statements/define/user.mdx index e57a8dde2..c67f9e7c1 100644 --- a/versioned_docs/version-1.x/surrealql/statements/define/user.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/define/user.mdx @@ -20,7 +20,7 @@ ___NOTE:___ While existing logins still function, the DEFINE LOGIN statement has - Root users can create Root, Namespace and Database users. - Namespace users can create Namespace and Database users - Database user can create Database users. -- To select the level where you want to create the user, [you may need to select a namespace and/or database](/docs/surrealdb/1.x/surrealql/statements/use) before you can use the `DEFINE USER` statement for database or namespace tokens. +- To select the level where you want to create the user, [you may need to select a namespace and/or database](/docs/surrealdb/surrealql/statements/use) before you can use the `DEFINE USER` statement for database or namespace tokens. :::note ___NOTE:___ You cannot use the DEFINE USER statement to create a SCOPE user. diff --git a/versioned_docs/version-1.x/surrealql/statements/insert.mdx b/versioned_docs/version-1.x/surrealql/statements/insert.mdx index 4f7c10fee..79cda08f5 100644 --- a/versioned_docs/version-1.x/surrealql/statements/insert.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/insert.mdx @@ -10,7 +10,7 @@ description: The INSERT statement can be used to insert or update data into the The `INSERT` statement can be used to insert or update data into the database, using the same statement syntax as the traditional SQL Insert statement. :::note -__Note:__This statement can not be used to create graph relationships. For that, use the [`RELATE`](/docs/surrealdb/1.x/surrealql/statements/relate) statement. +__Note:__This statement can not be used to create graph relationships. For that, use the [`RELATE`](/docs/surrealdb/surrealql/statements/relate) statement. ::: ### Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/live.mdx b/versioned_docs/version-1.x/surrealql/statements/live.mdx index 67cd92eb7..6ca13f2e8 100644 --- a/versioned_docs/version-1.x/surrealql/statements/live.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/live.mdx @@ -43,10 +43,10 @@ LIVE SELECT * FROM person; The result of the above query will be a UUID. This UUID is the Live Query Unique ID, and is used to differentate between different Live Queries. You will want to keep track of this ID, so that you can differentiate between different notifications being received after this query. -You can also use this UUID to [KILL (stop)](/docs/surrealdb/1.x/surrealql/statements/kill) the Live Query. +You can also use this UUID to [KILL (stop)](/docs/surrealdb/surrealql/statements/kill) the Live Query. The protocol will then send messages that are of a Notification format. -You can find an example of such a message in the [Live Query WebSocket protocol](/docs/surrealdb/1.x/integration/websocket#live) description. +You can find an example of such a message in the [Live Query WebSocket protocol](/docs/surrealdb/integration/websocket#live) description. ### Diff diff --git a/versioned_docs/version-1.x/surrealql/statements/relate.mdx b/versioned_docs/version-1.x/surrealql/statements/relate.mdx index 8e7132e61..32b966b79 100644 --- a/versioned_docs/version-1.x/surrealql/statements/relate.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/relate.mdx @@ -17,9 +17,9 @@ The key differences are that - Edge tables have two required fields in and out, which specify the directions of the relationships. - Edge tables are deleted once there are no existing relationships left. -Edge tables behave like normal tables in terms of [updating](/docs/surrealdb/1.x/surrealql/statements/update), [defining a schema](/docs/surrealdb/1.x/surrealql/statements/define/table) or [indexes](/docs/surrealdb/1.x/surrealql/statements/define/indexes). +Edge tables behave like normal tables in terms of [updating](/docs/surrealdb/surrealql/statements/update), [defining a schema](/docs/surrealdb/surrealql/statements/define/table) or [indexes](/docs/surrealdb/surrealql/statements/define/indexes). -[Record link](/docs/surrealdb/1.x/surrealql/datamodel/records) are the alternative option when connecting data. +[Record link](/docs/surrealdb/surrealql/datamodel/records) are the alternative option when connecting data. The key differences are that graph relations - Offer bi-directional querying. @@ -61,9 +61,9 @@ RELATE person:l19zjikkw1p1h9o6ixrg->wrote->article:8nkk6uj4yprt49z7y3zm; There is no relationship information stored in either the person or article table. Instead, an edge table (in this case a table called wrote) stores the relationship information. As you see, the structure `in -> id -> out` mirrors the record IDs from the `RELATE` statement, with the addition of the automatically generated ID for the wrote edge table. -By default, the edge table gets created as a schemaless table when you execute the `RELATE` statement. You can however make the table schemafull by either [defining a schema](/docs/surrealdb/1.x/surrealql/statements/define/table) before or after executing the RELATE statement. +By default, the edge table gets created as a schemaless table when you execute the `RELATE` statement. You can however make the table schemafull by either [defining a schema](/docs/surrealdb/surrealql/statements/define/table) before or after executing the RELATE statement. -A common use case is to make sure only unique relationships get created. You can do that by [defining an index](/docs/surrealdb/1.x/surrealql/statements/define/indexes). +A common use case is to make sure only unique relationships get created. You can do that by [defining an index](/docs/surrealdb/surrealql/statements/define/indexes). ```surql DEFINE INDEX unique_relationships @@ -101,7 +101,7 @@ Using the ONLY keyword, just an object for the relation in question will be retu RELATE ONLY person:l19zjikkw1p1h9o6ixrg->wrote->article:8nkk6uj4yprt49z7y3zm; ``` ## Basics of querying graphs -Let's look at how the above gets queried, for more examples see the [SELECT docs](/docs/surrealdb/1.x/surrealql/statements/select). +Let's look at how the above gets queried, for more examples see the [SELECT docs](/docs/surrealdb/surrealql/statements/select). For the questions below, each of the queries will give you the same answer. @@ -164,9 +164,9 @@ person:tobie Putting it all together it would be: based on all the products Tobie purchased, which person also purchased those products and what did they purchase? -## Using [`LET`](/docs/surrealdb/1.x/surrealql/statements/let) parameters in RELATE statements +## Using [`LET`](/docs/surrealdb/surrealql/statements/let) parameters in RELATE statements -You can also use [parameters](/docs/surrealdb/1.x/surrealql/parameters) to specify the record IDs. +You can also use [parameters](/docs/surrealdb/surrealql/parameters) to specify the record IDs. ```surql -- These two statements store the result of the subquery in a parameter @@ -181,7 +181,7 @@ LET $article = (SELECT VALUE id FROM article); RELATE $person->wrote->$article SET time.written = time::now(); ``` -## Using [`RETURN`](/docs/surrealdb/1.x/surrealql/statements/return) clause +## Using [`RETURN`](/docs/surrealdb/surrealql/statements/return) clause By default, the relate statement returns the record value once the changes have been made. To change the return value of each record, specify a RETURN clause, specifying either `NONE`, `BEFORE`, `AFTER`, `DIFF`, or a comma-separated list of specific fields to return. @@ -232,7 +232,7 @@ SELECT ->purchased->product<-purchased<-person->purchased->product FROM person:t ``` ## Deleting graph edges -You can also delete graph edges between two records in the database by using the [DELETE statement](/docs/surrealdb/1.x/surrealql/statements/delete). +You can also delete graph edges between two records in the database by using the [DELETE statement](/docs/surrealdb/surrealql/statements/delete). For example the graph edge below: diff --git a/versioned_docs/version-1.x/surrealql/statements/select.mdx b/versioned_docs/version-1.x/surrealql/statements/select.mdx index d8f3eebde..b36e17fe9 100644 --- a/versioned_docs/version-1.x/surrealql/statements/select.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/select.mdx @@ -121,7 +121,7 @@ SELECT *, (SELECT * FROM events WHERE type = 'activity' LIMIT 5) AS history FROM ## Using parameters Parameters can be used like variables to store a value which can then be used in a subsequent query. -SurrealDB also uses a few [predefined variables](/docs/surrealdb/1.x/surrealql/parameters). +SurrealDB also uses a few [predefined variables](/docs/surrealdb/surrealql/parameters). ```surql -- Store the subquery result in a variable and query that result. @@ -134,7 +134,7 @@ SELECT *, (SELECT * FROM events WHERE host == $parent.id) AS hosted_events FROM ## Record ranges -SurrealDB supports the ability to query a range of records, using the record ID. The record ID ranges, retrieve records using the natural sorting order of the record IDs. These range queries can be used to query a range of records in a timeseries context. You can see more here about [array-based Record IDs](/docs/surrealdb/1.x/surrealql/datamodel/ids#array-based-record-ids). +SurrealDB supports the ability to query a range of records, using the record ID. The record ID ranges, retrieve records using the natural sorting order of the record IDs. These range queries can be used to query a range of records in a timeseries context. You can see more here about [array-based Record IDs](/docs/surrealdb/surrealql/datamodel/ids#array-based-record-ids). ```surql -- Select all person records with IDs between the given range @@ -294,7 +294,7 @@ SELECT * FROM user LIMIT 50 START 50; ## Connect targets using the FETCH clause -One of the most powerful functions in SurrealDB are the [record links](/docs/surrealdb/1.x/surrealql/datamodel/records) and [graph connections](/docs/surrealdb/1.x/surrealql/statements/relate). +One of the most powerful functions in SurrealDB are the [record links](/docs/surrealdb/surrealql/datamodel/records) and [graph connections](/docs/surrealdb/surrealql/statements/relate). Instead of pulling data from multiple tables and merging that data together, SurrealDB allows you to traverse related records efficiently without needing to use JOINs. diff --git a/versioned_docs/version-1.x/surrealql/statements/show.mdx b/versioned_docs/version-1.x/surrealql/statements/show.mdx index e7d8b8f54..23be6118f 100644 --- a/versioned_docs/version-1.x/surrealql/statements/show.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/show.mdx @@ -10,7 +10,7 @@ description: The SHOW statement can be used to replay changes made to the table. The `SHOW` statement can be used to replay changes made to the table. ## Requirements -- You must first [`DEFINE`](/docs/surrealdb/1.x/surrealql/statements/define/table#example-usage) a [Change Feed](https://surrealdb.com/cf). +- You must first [`DEFINE`](/docs/surrealdb/surrealql/statements/define/table#example-usage) a [Change Feed](https://surrealdb.com/cf). ### Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/update.mdx b/versioned_docs/version-1.x/surrealql/statements/update.mdx index 34064a3ef..dadfa24a1 100644 --- a/versioned_docs/version-1.x/surrealql/statements/update.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/update.mdx @@ -10,7 +10,7 @@ description: The UPDATE statement can be used to update or modify records in the The `UPDATE` statement can be used to update or modify records in the database. :::note -__Note:__ This statement can not be used to create graph relationships. For that, use the [`RELATE`](/docs/surrealdb/1.x/surrealql/statements/relate) statement. +__Note:__ This statement can not be used to create graph relationships. For that, use the [`RELATE`](/docs/surrealdb/surrealql/statements/relate) statement. ::: ### Statement syntax diff --git a/versioned_docs/version-1.x/surrealql/statements/use.mdx b/versioned_docs/version-1.x/surrealql/statements/use.mdx index ac3e3f976..1f13e3ddc 100644 --- a/versioned_docs/version-1.x/surrealql/statements/use.mdx +++ b/versioned_docs/version-1.x/surrealql/statements/use.mdx @@ -7,9 +7,9 @@ description: The USE statement specifies a namespace and / or a database to use # `USE` statement -The `USE` statement specifies a namespace and / or a database to use for the subsequent SurrealQL statements when switching between namespaces and databases. If you have a single namespace and database, you can define them in the [sql command](/docs/surrealdb/1.x/cli/sql#example-usage). +The `USE` statement specifies a namespace and / or a database to use for the subsequent SurrealQL statements when switching between namespaces and databases. If you have a single namespace and database, you can define them in the [sql command](/docs/surrealdb/cli/sql#example-usage). -Ensure that your database and namespace exist and you have [started your database](/docs/surrealdb/1.x/cli/start) before using the Sql command option. +Ensure that your database and namespace exist and you have [started your database](/docs/surrealdb/cli/start) before using the Sql command option. ### Statement syntax @@ -32,7 +32,7 @@ USE DB test; -- Switch to the 'test' Database USE NS test DB test; -- Switch to the 'test' Namespace and 'test' Database ``` -You can also use the [INFO Statement](/docs/surrealdb/1.x/surrealql/statements/info) to check the current namespace and database. +You can also use the [INFO Statement](/docs/surrealdb/surrealql/statements/info) to check the current namespace and database. ```surql INFO FOR NS; -- Check the current Namespace diff --git a/versioned_docs/version-1.x/tutorials/connect-to-surrealdb-via-ngrok-tunnel.mdx b/versioned_docs/version-1.x/tutorials/connect-to-surrealdb-via-ngrok-tunnel.mdx index 657700aa3..0ef80c615 100644 --- a/versioned_docs/version-1.x/tutorials/connect-to-surrealdb-via-ngrok-tunnel.mdx +++ b/versioned_docs/version-1.x/tutorials/connect-to-surrealdb-via-ngrok-tunnel.mdx @@ -16,7 +16,7 @@ This setup is beneficial for remote development and quick testing of application This guide assumes the following: -- You have [SurrealDB installed](/docs/surrealdb/1.x/installation) and a [fresh instance of SurrealDB running.](/docs/surrealdb/1.x/introduction/start) +- You have [SurrealDB installed](/docs/surrealdb/installation) and a [fresh instance of SurrealDB running.](/docs/surrealdb/introduction/start) - Downloaded [Ngrok](https://ngrok.com/download) to be used as a tunnel. :::note @@ -27,7 +27,7 @@ Tunneling refers to the process of using a network protocol to encapsulate a dif ### Start SurrealDB Instance -Open your command line or terminal and run the following command to [start SurrealDB](/docs/surrealdb/1.x/introduction/start). +Open your command line or terminal and run the following command to [start SurrealDB](/docs/surrealdb/introduction/start). ```bash surreal start memory -A --auth --user root --pass root @@ -49,7 +49,7 @@ Keep this address handy as we will use it in the next step. ### Connect to SurrealDB via the Ngrok Address -Now, let's [connect to your SurrealDB instance](/docs/surrealdb/1.x/cli/sql/) using the forwarding address provided by Ngrok. +Now, let's [connect to your SurrealDB instance](/docs/surrealdb/cli/sql/) using the forwarding address provided by Ngrok. Run the following command in a new terminal window/tab, replacing **`[ngrok-address]`** with the actual Ngrok forwarding address you noted earlier: @@ -60,7 +60,7 @@ surreal sql --conn wss://[ngrok-address] --user root --pass root --ns test --db ### Verify the Connection Finally, let’s ensure the connection is properly set up by running a test query. -With the help of the `CREATE` statement, [create a new record](/docs/surrealdb/1.x/surrealql/statements/create). +With the help of the `CREATE` statement, [create a new record](/docs/surrealdb/surrealql/statements/create). ```surql CREATE registration SET @@ -71,7 +71,7 @@ address_line2 = 'Near Diagon Alley', city = 'Hogwarts', country = 'England'; ``` -And let's [query the data](/docs/surrealdb/1.x/surrealql/statements/select) from the record now. +And let's [query the data](/docs/surrealdb/surrealql/statements/select) from the record now. ```surql SELECT * FROM registration ``` diff --git a/versioned_docs/version-1.x/tutorials/index.mdx b/versioned_docs/version-1.x/tutorials/index.mdx index 88ae0c131..f93fbba14 100644 --- a/versioned_docs/version-1.x/tutorials/index.mdx +++ b/versioned_docs/version-1.x/tutorials/index.mdx @@ -13,7 +13,7 @@ Welcome to the tutorial section. Here you will find comprehensive, step-by-step The purpose of this section is to provide you with practical instructions and examples to help you understand and use SurrealDB effectively. Each tutorial is designed to be concise, easy to follow, and accompanied by code snippets and examples to illustrate the concepts. -If you are new to SurrealDB, we recommend that you start with the [Getting Started](/docs/surrealdb/1.x/introduction/start) section of the documentation or the [SurrealQL](/docs/surrealdb/1.x/surrealql). This section will provide you with a solid foundation of the core concepts and features of SurrealDB. +If you are new to SurrealDB, we recommend that you start with the [Getting Started](/docs/surrealdb/introduction/start) section of the documentation or the [SurrealQL](/docs/surrealdb/surrealql). This section will provide you with a solid foundation of the core concepts and features of SurrealDB. ## Tutorials @@ -21,7 +21,7 @@ Within this section, you will find a collection of tutorials that cover a wide r To get started, select a tutorial from the sidebar or use the search functionality to find a specific topic of interest. Each tutorial provides clear instructions, code examples, and explanations to help you understand and use the feature effectively. -- [ Working with SurrealDB over HTTP via Postman](/docs/surrealdb/1.x/tutorials/working-with-surrealdb-over-http-via-postman) -- [Integrate Auth0 as an Authentication provider](/docs/surrealdb/1.x/tutorials/integrate-auth0-as-authentication-provider) -- [Integrate AWS Cognito as an Authentication Provider](/docs/surrealdb/1.x/tutorials/integrate-aws-cognito-as-authentication-provider) -- [Connect to SurrealDB via Ngrok tunnel](/docs/surrealdb/1.x/tutorials/connect-to-surrealdb-via-ngrok-tunnel) +- [ Working with SurrealDB over HTTP via Postman](/docs/surrealdb/tutorials/working-with-surrealdb-over-http-via-postman) +- [Integrate Auth0 as an Authentication provider](/docs/surrealdb/tutorials/integrate-auth0-as-authentication-provider) +- [Integrate AWS Cognito as an Authentication Provider](/docs/surrealdb/tutorials/integrate-aws-cognito-as-authentication-provider) +- [Connect to SurrealDB via Ngrok tunnel](/docs/surrealdb/tutorials/connect-to-surrealdb-via-ngrok-tunnel) diff --git a/versioned_docs/version-1.x/tutorials/integrate-auth0-as-authentication-provider.mdx b/versioned_docs/version-1.x/tutorials/integrate-auth0-as-authentication-provider.mdx index 43dfe4a59..b5732f025 100644 --- a/versioned_docs/version-1.x/tutorials/integrate-auth0-as-authentication-provider.mdx +++ b/versioned_docs/version-1.x/tutorials/integrate-auth0-as-authentication-provider.mdx @@ -21,9 +21,9 @@ This guide will cover the most general case, in which SurrealDB is the only back This guide assumes the following: -- You have a [fresh instance of SurrealDB running.](/docs/surrealdb/1.x/introduction/start) +- You have a [fresh instance of SurrealDB running.](/docs/surrealdb/introduction/start) -- You can [use a local Docker container](/docs/surrealdb/1.x/installation/running/docker) without volumes for the purposes of this guide. +- You can [use a local Docker container](/docs/surrealdb/installation/running/docker) without volumes for the purposes of this guide. ```bash docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest \ @@ -97,7 +97,7 @@ This action should be saved and added to the “Login” flow in the “Actions ### Defining a token verification method in SurrealDB -Next, we should configure SurrealDB so that it can verify tokens sent to it through the [HTTP REST API](/docs/surrealdb/1.x/integration/http) via the “Authorization” header or through any of the [SDKs](/docs/surrealdb/1.x/integration/sdks) via the “Authenticate” methods. +Next, we should configure SurrealDB so that it can verify tokens sent to it through the [HTTP REST API](/docs/surrealdb/integration/http) via the “Authorization” header or through any of the [SDKs](/docs/surrealdb/integration/sdks) via the “Authenticate” methods. To do that, we will leverage the JWKS support in SurrealDB in order to define a token verification mechanism pointing to a JWKS object served by Auth0. This JWKS object can be found in a [dedicated endpoint for your Auth0 domain](https://auth0.com/docs/secure/tokens/json-web-tokens/locate-json-web-key-sets). @@ -171,7 +171,7 @@ It is also important to note that the `$auth` variable accessible from SurrealQL Now that we have everything ready for Auth0 to generate tokens and for SurrealDB to receive and verify them, we will modify our simple web application to use the token issued by Auth0 to register a new user or to update its information if the user already exists. -Because of the diversity of SDKs that both SurrealDB and Auth0 support, it is difficult to provide examples that will work for everyone. In this guide, we will provide code examples for the most unspecific use case of using the [SurrealDB HTTP REST API](/docs/surrealdb/1.x/integration/http) and [Auth0 SPA JS](https://github.com/auth0/auth0-spa-js). +Because of the diversity of SDKs that both SurrealDB and Auth0 support, it is difficult to provide examples that will work for everyone. In this guide, we will provide code examples for the most unspecific use case of using the [SurrealDB HTTP REST API](/docs/surrealdb/integration/http) and [Auth0 SPA JS](https://github.com/auth0/auth0-spa-js). This code will run entirely on the client and can be added to the static website that you created while following the Auth0 quick start documentation linked at the beginning of this guide. @@ -237,7 +237,7 @@ const createUpdateUser = async () => { If you want to see how this code would fit inside the web application that you built, you can view this [minimal example created by SurrealDB](https://github.com/surrealdb/examples/tree/main/auth0). -To learn about other potential uses for the SurrealDB token functionality, you can read the [`DEFINE TOKEN` documentation page](/docs/surrealdb/1.x/surrealql/statements/define/token). +To learn about other potential uses for the SurrealDB token functionality, you can read the [`DEFINE TOKEN` documentation page](/docs/surrealdb/surrealql/statements/define/token). ## Annex diff --git a/versioned_docs/version-1.x/tutorials/integrate-aws-cognito-as-authentication-provider.mdx b/versioned_docs/version-1.x/tutorials/integrate-aws-cognito-as-authentication-provider.mdx index d233d110e..3d4391178 100644 --- a/versioned_docs/version-1.x/tutorials/integrate-aws-cognito-as-authentication-provider.mdx +++ b/versioned_docs/version-1.x/tutorials/integrate-aws-cognito-as-authentication-provider.mdx @@ -21,9 +21,9 @@ This guide will cover the most general case, in which SurrealDB is the only back This guide assumes the following: -- You have a [fresh instance of SurrealDB running](/docs/surrealdb/1.x/introduction/start) with version `1.2.0` or later. +- You have a [fresh instance of SurrealDB running](/docs/surrealdb/introduction/start) with version `1.2.0` or later. -- You can [use a local Docker container](/docs/surrealdb/1.x/installation/running/docker) without volumes for the purposes of this guide. +- You can [use a local Docker container](/docs/surrealdb/installation/running/docker) without volumes for the purposes of this guide. ```bash docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest \ @@ -111,13 +111,13 @@ Depending on how you configured your user pool, users will be able to register b ### Defining a token verification method in SurrealDB -Next, we should configure SurrealDB so that it can verify tokens sent to it through the [HTTP REST API](/docs/surrealdb/1.x/integration/http) via the “Authorization” header or through any of the [SDKs](/docs/surrealdb/1.x/integration/sdks) via the “Authenticate” methods. +Next, we should configure SurrealDB so that it can verify tokens sent to it through the [HTTP REST API](/docs/surrealdb/integration/http) via the “Authorization” header or through any of the [SDKs](/docs/surrealdb/integration/sdks) via the “Authenticate” methods. -To do that, we will leverage the [JWKS support in SurrealDB](/docs/surrealdb/1.x/surrealql/statements/define/token#json-web-key-set-jwks-since-120) in order to define a token verification mechanism pointing to a JWKS object served by AWS for your Cognito user pool. This JWKS object can be found in an endpoint [build from your AWS region and user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html) in the format `https://cognito-idp..amazonaws.com//.well-known/jwks.json`. +To do that, we will leverage the [JWKS support in SurrealDB](/docs/surrealdb/surrealql/statements/define/token#json-web-key-set-jwks-since-120) in order to define a token verification mechanism pointing to a JWKS object served by AWS for your Cognito user pool. This JWKS object can be found in an endpoint [build from your AWS region and user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html) in the format `https://cognito-idp..amazonaws.com//.well-known/jwks.json`. Pointing to a remote JWKS object ensures that token verification will work seamlessly even in the case that AWS rotates their encryption keys and that tokens signed with revoked keys will no longer be accepted by SurrealDB. -To understand how revocation is handled by SurrealDB, read the [JSON Web Key Set documentation](/docs/surrealdb/1.x/surrealql/statements/define/token#json-web-key-set-jwks-since-120) under `DEFINE TOKEN`. +To understand how revocation is handled by SurrealDB, read the [JSON Web Key Set documentation](/docs/surrealdb/surrealql/statements/define/token#json-web-key-set-jwks-since-120) under `DEFINE TOKEN`. The following queries will create the required resources to authenticate a token for a scope using JWKS: @@ -139,7 +139,7 @@ DEFINE TOKEN cognito ON SCOPE user TYPE JWKS In the example above, replace the placeholders with values applicable to your Cognito user pool. -In order to allow SurrealDB to establish a connection with AWS Cognito to download the JWKS object, you will require running it with the network capability. +In order to allow SurrealDB to establish a connection with AWS Cognito to download the JWKS object, you will require running it with the network capability. For the strongest security, provide your specific Cognito user pool domain when starting SurrealDB with `--allow-net`. For example: `--allow-net cognito-idp.eu-west-1.amazonaws.com`. diff --git a/versioned_docs/version-1.x/tutorials/working-with-surrealdb-over-http-via-postman.mdx b/versioned_docs/version-1.x/tutorials/working-with-surrealdb-over-http-via-postman.mdx index 0522a2e20..d47e80ed0 100644 --- a/versioned_docs/version-1.x/tutorials/working-with-surrealdb-over-http-via-postman.mdx +++ b/versioned_docs/version-1.x/tutorials/working-with-surrealdb-over-http-via-postman.mdx @@ -11,36 +11,36 @@ SurrealDB provides a RESTful HTTP API for interacting with the database. In this tutorial, you will learn how to query SurrealDB endpoints via the [Postman collection](https://postman.com/surrealdb/workspace/surrealdb/collection/19100500-3da237f3-588b-4252-8882-6d487c11116a). SurrealDB supports requests via HTTP & Rest with which you can handle different queries from creating simple tables to having Graph relationships between complex tables. -Check out the [HTTP & Rest integration documentation](/docs/surrealdb/1.x/integration/http) for a detailed list of all the endpoints supported. +Check out the [HTTP & Rest integration documentation](/docs/surrealdb/integration/http) for a detailed list of all the endpoints supported. ## Prerequisites This tutorial assumes that you have the following: - A Postman account to fork the [SurrealDB collection](https://postman.com/surrealdb/workspace/surrealdb/collection/19100500-3da237f3-588b-4252-8882-6d487c11116a) -- SurrealDB installed - If you do not, see the [installation guide](/docs/surrealdb/1.x/installation) specific to your machine. +- SurrealDB installed - If you do not, see the [installation guide](/docs/surrealdb/installation) specific to your machine. ## Getting Started. Before forking the Collection from Postman, ensure that you have your SurrealDB instance running locally because by default the collection endpoint is set to [`localhost:8000`](http://localhost:8000) or [`http://127.0.0.1:8000`](http://127.0.0.1:8000/) -To do so run the [Start command](/docs/surrealdb/1.x/cli/start) in your terminal: +To do so run the [Start command](/docs/surrealdb/cli/start) in your terminal: ```surql surreal start --auth --user root --pass root ``` -The above command [enables authentication](/docs/surrealdb/1.x/cli/start#authentication) with `--auth` and specifies that the user and password are `root` - Note that this is just for demonstration purposes. You can replace it with any other word. +The above command [enables authentication](/docs/surrealdb/cli/start#authentication) with `--auth` and specifies that the user and password are `root` - Note that this is just for demonstration purposes. You can replace it with any other word. -After running locally, head over to Postman and create a fork for your workspace. You should see all the endpoints listed. You can also [check the endpoints in the documentation](/docs/surrealdb/1.x/integration/http). +After running locally, head over to Postman and create a fork for your workspace. You should see all the endpoints listed. You can also [check the endpoints in the documentation](/docs/surrealdb/integration/http). -## Using [`INFO` Statement](/docs/surrealdb/1.x/surrealql/statements/info) +## Using [`INFO` Statement](/docs/surrealdb/surrealql/statements/info) -You can get information about your workspace by using the INFO statement. However, you need the right permissions in other to see the output. See the documentation for the [INFO statement](/docs/surrealdb/1.x/surrealql/statements/info). +You can get information about your workspace by using the INFO statement. However, you need the right permissions in other to see the output. See the documentation for the [INFO statement](/docs/surrealdb/surrealql/statements/info). It is also important to note that the `namespace` and `database` values for the Postman collection are set to `test` by default. -You can see the JSON output using the [INFO statement](/docs/surrealdb/1.x/surrealql/statements/info) in the body of the request +You can see the JSON output using the [INFO statement](/docs/surrealdb/surrealql/statements/info) in the body of the request ```surql INFO FOR ROOT / DB / NS @@ -77,13 +77,13 @@ Accept:application/json NS:{{namespace}} DB:{{database}} ``` -You can also [define a user](/docs/surrealdb/1.x/surrealql/statements/define/user) with other credentials such as Root or Database user. For this tutorial, we will be using only Scope users. +You can also [define a user](/docs/surrealdb/surrealql/statements/define/user) with other credentials such as Root or Database user. For this tutorial, we will be using only Scope users. :::note __Note:__ The Namespace and Database fields are set to the value `test` by default. You can change this in the collection settings. ::: -In the request body, [define the scope](/docs/surrealdb/1.x/surrealql/statements/define/scope) `human` with a session of 24 hours: +In the request body, [define the scope](/docs/surrealdb/surrealql/statements/define/scope) `human` with a session of 24 hours: ```surql DEFINE SCOPE human SESSION 24h @@ -92,9 +92,9 @@ DEFINE SCOPE human SESSION 24h ; ``` -The code above allows a user to sign up as a scope user with their email and password. Then hash the password with the [`crypto::argon2::generate`](/docs/surrealdb/1.x/surrealql/functions/crypto#cryptoargon2generate) function +The code above allows a user to sign up as a scope user with their email and password. Then hash the password with the [`crypto::argon2::generate`](/docs/surrealdb/surrealql/functions/crypto#cryptoargon2generate) function -The sign in logic gets all the users where the emails match and uses the [`crypto::argon2::compare`](/docs/surrealdb/1.x/surrealql/functions/crypto#cryptoargon2compare) function to check the hash value to the unhashed. +The sign in logic gets all the users where the emails match and uses the [`crypto::argon2::compare`](/docs/surrealdb/surrealql/functions/crypto#cryptoargon2compare) function to check the hash value to the unhashed. Now when you get the info of the Database using `INFO for DB` you can see the scope `human` get the following output: @@ -183,7 +183,7 @@ This should return a similar JSON object indicating successful authentication an ## Using Table Endpoints -The Postman collection has a couple of endpoints for `POST` `GET` `PUT` `PATCH` `DEL` operations. For example, If you want to add a new entry to the table `Person` (Which is the default table in the collection) go to the [`POST /key/:table`](/docs/surrealdb/1.x/integration/http#post-table) endpoint then in a body of the request and add the table content in the body of the request. E.g: +The Postman collection has a couple of endpoints for `POST` `GET` `PUT` `PATCH` `DEL` operations. For example, If you want to add a new entry to the table `Person` (Which is the default table in the collection) go to the [`POST /key/:table`](/docs/surrealdb/integration/http#post-table) endpoint then in a body of the request and add the table content in the body of the request. E.g: ```json { @@ -192,7 +192,7 @@ The Postman collection has a couple of endpoints for `POST` `GET` `PUT` `PATCH` } ``` -You should get a response as seen below, notice that there is a [record ID](/docs/surrealdb/1.x/surrealql/datamodel/ids), with this record ID you can now use any of the [`/key/:table/:id`](/docs/surrealdb/1.x/integration/http#get-record) endpoints for `POST` `GET` `PUT` `PATCH` `DEL` operations. +You should get a response as seen below, notice that there is a [record ID](/docs/surrealdb/surrealql/datamodel/ids), with this record ID you can now use any of the [`/key/:table/:id`](/docs/surrealdb/integration/http#get-record) endpoints for `POST` `GET` `PUT` `PATCH` `DEL` operations. ```json [ @@ -214,4 +214,4 @@ You should get a response as seen below, notice that there is a [record ID](/doc In this tutorial, we've walked through how to set up and use SurrealDB over HTTP using Postman. We've covered how to define a new user scope, sign up a new user, and sign in with a user. These steps are crucial for managing user authentication in your applications using SurrealDB. -The Postman collection is still in active development for more information on using surrealDB via the HTTP endpoints. [Check out our documentation on HTTP and rest endpoints](/docs/surrealdb/1.x/integration/http) \ No newline at end of file +The Postman collection is still in active development for more information on using surrealDB via the HTTP endpoints. [Check out our documentation on HTTP and rest endpoints](/docs/surrealdb/integration/http) \ No newline at end of file