Skip to content

Commit

Permalink
Merge branch 'main' into see-all-relations-example
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhghomon authored Dec 12, 2024
2 parents b4dea42 + 5875cd5 commit 63d06ae
Show file tree
Hide file tree
Showing 26 changed files with 238 additions and 43 deletions.
Binary file modified src/assets/img/image/cloud/configure-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/image/cloud/instance-capabilities.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/image/cloud/open-in-http.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/content/doc-cloud/advanced-topics/migrating-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Surreal Cloud is a hosted version of SurrealDB, providing a fully managed, scala

## Exporting and importing data

1. Export your current data as SQL. You can do this using the [`surreal export`](/docs/surrealdb/cli/export) command in the terminal:
1. Export your current data as a `.surql` (SurrealQL) file. You can do this using the [`surreal export`](/docs/surrealdb/cli/export) command in the terminal:

```bash
# Example export command to export data to a file called `export.surql` in the downloads directory.
Expand Down
39 changes: 39 additions & 0 deletions src/content/doc-cloud/connect/http.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
sidebar_position: 5
sidebar_label: Connect via HTTP using cURL
title: Connect via HTTP using cURL | Surreal Cloud
description: Connect to your Surreal Cloud instance using the HTTP API and run queries.
---

import Image from "@components/Image.astro";

import OpenInHTTPCurlLight from '@img/image/cloud/open-in-http.png';
import OpenInHTTPCurlDark from '@img/image/cloud/open-in-http.png';

# Connect via HTTP using cURL

Surreal Cloud supports connection via HTTP. This allows you to connect to your Surreal Cloud Instance using curl or any HTTP client. To get started, select the **Connect** button on your Instance. Then select **HTTP cURL**.

This will open a modal to fill in your credentials for **Namespace** and **Database** and authentication before you can copy the URL.


<Image
alt="Open in HTTP cURL"
src={{
light: OpenInHTTPCurlLight,
dark: OpenInHTTPCurlDark,
}}
/>


> [!NOTE]
> The URL provided can be used in any HTTP client, but by default it is set to use curl. Use the URL in your HTTP client to connect to your Surreal Cloud Instance from clients like Postman or any other HTTP client.
## Connect to your Surreal Cloud Instance

Once you have filled in the credentials, copy the URL and connect to your Surreal Cloud Instance. Below is an example of the connection URL in curl.

```bash
curl -X GET "https://cloud-demo-069qmb9jjttknc0djomp73flfs.aws-use1.surreal.cloud/version"
```

1 change: 1 addition & 0 deletions src/content/doc-cloud/connect/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ You can connect to your Surreal Cloud instances in three main ways. In this sect
- [connect via Surrealist](/docs/cloud/connect/surrealist) : Surrealist is a query builder and IDE for SurrealDB. It allows you to connect to your Surreal Cloud Instance and run queries in a graphical interface.
- [connect via CLI](/docs/cloud/connect/cli) : using the command-line interface for SurrealDB, you can connect to your Surreal Cloud Instance and run queries in a command-line interface.
- [connect via SDK](/docs/cloud/connect/sdk) : Surreal Cloud supports a variety of SDKs for connecting to your Instance. You can use the SDKs to connect to your Instance and run queries in your preferred programming language.
- [connect via HTTP](/docs/cloud/connect/http) : Surreal Cloud supports a REST API for connecting to your Instance. You can use the API to connect to your Instance and run queries using CURL or any HTTP client.

## Before you begin

Expand Down
21 changes: 13 additions & 8 deletions src/content/doc-cloud/connect/sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,23 @@ db.use("example_ns", "example_db")
db.sign_in("root", "root")
```
</TabItem>
<TabItem value=".Net" label=".Net">

```dotnet
<TabItem value=".NET" label=".NET">

```csharp
using SurrealDb.Net;
using SurrealDb.Net.Models;
using SurrealDb.Net.Models.Auth;
using System.Text.Json;

var db = new SurrealDbClient("https://cloud-docs-068rp16e0hsnl62vgooa7omjks.aws-euw1.staging.surrealdb.cloud/rpc");
// Configure a connection to use ns/db, as well as root access (with username and password)
client.Configure("Cloud Namespace", "Cloud Database", "<created root user>", "<created root password>");
using var db = new SurrealDbClient("https://cloud-docs-068rp16e0hsnl62vgooa7omjks.aws-euw1.staging.surrealdb.cloud/rpc");

// Select a namespace and database
await db.Use("Cloud Namespace", "Cloud Database");

// Authenticate
await db.SignIn(new RootAuth
{
Username = "<created root user>",
Password = "<created root password>",
});
```
</TabItem>
<TabItem value="PHP" label="PHP">
Expand Down
5 changes: 3 additions & 2 deletions src/content/doc-cloud/faqs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ You need to create a User first. Head to the [connect via SDK](/docs/cloud/conne

Currently, you can not backup your data with Surreal Cloud (Beta). However, you can use the [`export` command](/docs/surrealdb/cli/export) to backup your data via the SurrealDB CLI.


### What are the limits of the Surreal Cloud (Beta)?

It is not currently possible to configure CLI arguments or environment variables in Surreal Cloud (Beta).
It is not currently possible to configure [CLI](/docs/surrealdb/cli) arguments or environment variables in Surreal Cloud (Beta).

Surreal Cloud (Beta) nodes run with the default [SurrealDB capabilities](/docs/surrealdb/security/capabilities) except for allowing network access to the Cloud API for the purposes of authenticating with Surrealist.

Surreal Cloud (Beta) does not currently allow outgoing network requests, scripting, or guest access. All functions, RPC methods and all HTTP routes are allowed.

[GraphQL support](/docs/surrealdb/querying/graphql) is not yet enabled on Surreal Cloud (Beta) instances.

> [!NOTE]
> Free Tier instances surpassing the 1GB free storage allowance will be limited to data retrieval only. Unless you upgrade to a paid tier, you will not be able to create new data.
Expand Down
9 changes: 6 additions & 3 deletions src/content/doc-sdk-dotnet/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import TabItem from "@components/Tabs/TabItem.astro";
import { packageName, fetchNugetVersion } from './utils';

export const value = await fetchNugetVersion();
export const packageReferenceXml = `<PackageReference Include="SurrealDb.Net" Version="${value}" />`;

# Installation

Expand All @@ -37,9 +38,11 @@ dotnet add package SurrealDb.Net
</TabItem>
<TabItem value="package-reference" label="PackageReference">

```xml
<PackageReference Include="SurrealDb.Net" Version="0.6.0" />
```
<pre>
<code class="language-xml">
{packageReferenceXml}
</code>
</pre>

</TabItem>
</Tabs>
Expand Down
23 changes: 18 additions & 5 deletions src/content/doc-sdk-java/components/JavaVersion.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
---
const result = await fetch(
'https://search.maven.org/solrsearch/select?q=g:%22com.surrealdb%22+AND+a:%22surrealdb%22&wt=json'
);
const data = await result.json();
const version = data?.response?.docs[0]?.latestVersion ?? 'Unknown';
let version = 'Unknown';
try {
const result = await fetch(
'https://search.maven.org/solrsearch/select?q=g:%22com.surrealdb%22+AND+a:%22surrealdb%22&wt=json'
);
if (!result.ok) {
throw new Error(`HTTP error! status: ${result.status}`);
}
const contentType = result.headers.get('content-type');
if (!contentType || !contentType.includes('application/json')) {
throw new Error('Response is not JSON');
}
const data = await result.json();
version = data?.response?.docs[0]?.latestVersion ?? 'Unknown';
} catch (error) {
console.error('Error fetching version:', error);
// Keep the default 'Unknown' value
}
---

<code>{version}</code>
4 changes: 2 additions & 2 deletions src/content/doc-sdk-java/data-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: Where you can find the API documentation for the SurrealDB SDK for
The Java SDK translates all datatypes native to SurrealQL into either datatypes native to Java, or a custom implementation. This document describes all datatypes, and links to their respective documentation.

## Data Types overview

{/*
<table>
<thead>
<tr>
Expand Down Expand Up @@ -157,4 +157,4 @@ The Java SDK translates all datatypes native to SurrealQL into either datatypes
</td>
</tr>
</tbody>
</table>
</table> */}
5 changes: 4 additions & 1 deletion src/content/doc-sdk-java/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ In this section, you will learn how to install the Java SDK in your project.

First, install the [SurrealDB SDK](https://mvnrepository.com/artifact/com.surrealdb/surrealdb) from the Maven Central repository using [Gradle](https://gradle.org/) or [Maven](https://maven.apache.org/).

The latest version of the SDK is currently <JavaVersion />
{/* The latest version of the SDK is currently <JavaVersion/> */}


<Tabs groupId="java-build-tool">
<TabItem value="gradle-groovy" label="Gradle (Groovy)" default>
Expand All @@ -31,7 +32,9 @@ dependencies {
}
```
</TabItem>

<TabItem value="gradle-kotlin" label="Gradle (Kotlin)">

```groovy
val surrealdbVersion by extra("0.2.0")
Expand Down
2 changes: 1 addition & 1 deletion src/content/doc-sdk-java/start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This guide assumes the following:
The SurrealDB Java SDK is available on the Maven Central repository. You can install it using [Gradle](https://gradle.org/) or [Maven](https://maven.apache.org/).
Copy the relevant code snippet into your `build.gradle` or `pom.xml` file to add the SDK as a dependency.

The latest version of the SDK is currently <JavaVersion />
{/* The latest version of the SDK is currently <JavaVersion /> */}

<Tabs groupId="java-build-tool">
<TabItem value="gradle-groovy" label="Gradle (Groovy)" default>
Expand Down
4 changes: 2 additions & 2 deletions src/content/doc-sdk-rust/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The SurrealDB SDK for Rust is the primary method of interacting with SurrealDB f
> [!NOTE]
> The SDK works seamlessly with SurrealDB versions `v2.0.0` to <Version />, ensuring compatibility with the latest version.
To contribute to the SDK code, submit an Issue or Pull Request in the [surrealdb.rust](https://github.com/surrealdb/surrealdb.rust) repository. To contribute to this documentation, submit an Issue or Pull Request in the [docs.surrealdb.com](https://github.com/surrealdb/docs.surrealdb.com) repository.
To contribute to the SDK code, submit an Issue or Pull Request in the [surrealdb.rust](https://github.com/surrealdb/surrealdb/tree/main/crates/sdk) repository. To contribute to this documentation, submit an Issue or Pull Request in the [docs.surrealdb.com](https://github.com/surrealdb/docs.surrealdb.com) repository.

## Frameworks

Expand Down Expand Up @@ -82,6 +82,6 @@ To contribute to the SDK code, submit an Issue or Pull Request in the [surrealdb

## Sources

- [GitHub repository](https://github.com/surrealdb/surrealdb/tree/main/sdk)
- [GitHub repository](https://github.com/surrealdb/surrealdb/tree/main/crates/sdk)
- [Crates.io package](https://crates.io/crates/surrealdb)
- [Docs.rs documentation](https://docs.rs/surrealdb/latest/surrealdb/)
2 changes: 1 addition & 1 deletion src/content/doc-surrealdb/cli/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Unless you specify otherwise, the CLI will start a database in memory that serve
In another window, you can then open up an interactive shell to make queries using the `surreal sql` command.

```bash
surreal sql --endpoint http://localhost:8000 --namespace ns --database db --pretty
surreal sql --endpoint http://localhost:8000 --namespace ns --database db --username root --password root --pretty
```

> [!WARNING]
Expand Down
6 changes: 2 additions & 4 deletions src/content/doc-surrealdb/cli/start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,12 @@ surreal start memory --user my_username --pass my_password

The server is actively running, and should be left alone until you want to stop hosting the SurrealDB server.


> [!NOTE]
> The message "Started web server on 127.0.0.1:8000", indicates where the server is being hosted and must be accessed by clients. The location `127.0.0.1:8000` is the default, and can be manually changed by specifying the `--bind` option of the `surreal start` command.
The `surreal start` command starts the server as a whole without regard to individual namespaces or databases.

To access the SurrealDB server that you have started hosting, open a separate terminal which will act as the "client", while the previous terminal is still running the `surreal start` command described above.

In the new terminal, run the [`surreal sql` command](/docs/surrealdb/cli/sql) using the options shown below.
To access the SurrealDB server that you have started hosting, open a new terminal which will act as the "client", while the previous terminal is still running the `surreal start` command described above. This is done using a separate [`surreal sql` command](/docs/surrealdb/cli/sql). A particular namespace and database can be specified using the `surreal sql` command, as seen below.

```bash
surreal sql --endpoint http://127.0.0.1:8000 --namespace my_namespace --database my_database --auth-level root --username my_username --password my_password
Expand Down
6 changes: 3 additions & 3 deletions src/content/doc-surrealdb/embedding/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import DarkLogo from "@img/icon/dark/javascript.png";

SurrealDB is designed to be run in many different ways, and environments. Due to the [separation of the storage and compute](/docs/surrealdb/introduction/architecture) layers, SurrealDB can be run in embedded mode, from within your JavaScript environments.

You can embed SurrealDB in both browser and server environments. In browser environments using the [Wasm engine](/docs/sdk/javascript/engines/wasm), SurrealDB can be run as an in-memory database, or it can persist data using IndexedDB. In server environments using the [Node.js engine](/docs/sdk/javascript/engines/nodejs), SurrealDB can be run as an embedded database, backed by either an in-memory engine or [SurrealKV](/docs/surrealdb/cli/start#surrealkv-beta).
You can embed SurrealDB in both browser and server environments. In browser environments using the [Wasm engine](/docs/sdk/javascript/engines/wasm), SurrealDB can be run as an in-memory database, or it can persist data using IndexedDB. In server environments using the [Node.js engine](/docs/sdk/javascript/engines/node), SurrealDB can be run as an embedded database, backed by either an in-memory engine or [SurrealKV](/docs/surrealdb/cli/start#surrealkv-beta).

In this document, we will cover how to embed SurrealDB in both browser and server environments.

Expand All @@ -34,6 +34,6 @@ For more information on how to embed SurrealDB in browser environments, please s

## Server

In server environments, you can use the [Node.js engine](/docs/sdk/javascript/engines/nodejs) to run SurrealDB as an embedded database.
In server environments, you can use the [Node.js engine](/docs/sdk/javascript/engines/node) to run SurrealDB as an embedded database.

For more information on how to embed SurrealDB in server environments, please see the [Node.js engine](/docs/sdk/javascript/engines/nodejs) documentation.
For more information on how to embed SurrealDB in server environments, please see the [Node.js engine](/docs/sdk/javascript/engines/node) documentation.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Although the `surreal fix` command is a quick way to migrate your data, it is no

The `surreal fix` command above has been created specifically for 1.x instances. However, data currently on a `2.0.0-alpha` instance can still be manually exported and then reimported into a project running on `2.0.0` via the following steps.

1. Export your current data as SQL. You can do this using the [`surreal export`](/docs/surrealdb/cli/export) command in the terminal:
1. Export your current data as a `.surql` (SurrealQL) file. You can do this using the [`surreal export`](/docs/surrealdb/cli/export) command in the terminal:

```bash
# Example export command to export data to a file called `export.surql` in the downloads directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ In order to interact with a SurrealDB database you must first create a connectio

After opening a connection, you can switch to another connection at any time by pressing the connection name in the top left of the interface. This will open the connection list allowing you to switch to another connection, or create a new one.

Within the connection list you will also find a special connection called Sandbox, which is always available and allows you to test and experiment without storing data persistently. This connection is useful for learning SurrealQL, testing queries, and more.
Within the connection list you will also find a special connection called Sandbox, which is always available and allows you to test and experiment without storing data persistently. This connection is useful for learning SurrealQL, testing queries, and more. The Sandbox connection is designed for simple testing and not for evaluating performance, as it is limited to a single thread within the browser's WebAssembly engine.

You can also create a new custom connection, this will allow you to connect to a remote SurrealDB instance, or a local instance this will also require you to set the namespace and database.

Expand Down
6 changes: 2 additions & 4 deletions src/content/doc-surrealist/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ When you select an active connection in Surrealist, you will connect to the data

After opening a connection, you can switch to another connection at any time by pressing the connection name in the top left of the interface. This will open the connection list allowing you to switch to another connection, or create a new one.

Within the connection list you will also find a special connection called <span style={{ color: 'var(--ifm-font-color-base)' }}>Sandbox</span>, which is always available and allows you to test and experiment without storing data persistently.
This connection is useful for learning SurrealQL, testing queries, and more.
Within the connection list you will also find a special connection called <span style={{ color: 'var(--ifm-font-color-base)' }}>Sandbox</span>, which is always available and allows you to test and experiment without storing data persistently. This connection is useful for learning SurrealQL, testing queries, and more. As the Sandbox connection runs inside a single thread within the browser's WebAssembly engine, it should not be used to estimate or evaluate performance.

## Creating a connection

Expand Down Expand Up @@ -74,8 +73,7 @@ dialog you can also find an option to change the appearance of the navigation si

## Using the Sandbox

As mentioned earlier, the sandbox environment is a special connection that allows you to test and learn SurrealQL. When active, the toolbar will provide
some additional buttons useful for working with the sandbox environment.
As mentioned earlier, the sandbox environment is a special connection that allows you to test and learn SurrealQL. When active, the toolbar will provide some additional buttons useful for working with the sandbox environment.

- **Reset sandbox**: This button will clear any records and schema you have configured in the sandbox. Use this button to start fresh or clear your sandbox environment.
- **Load demo dataset**: This button will load an official demo dataset into the sandbox environment. This dataset contains a set of records and relations that you can explore and query.
Expand Down
5 changes: 5 additions & 0 deletions src/content/doc-surrealql/datamodel/ids.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,18 @@ CREATE temperature:['London', $now] SET
```

### Generating Record IDs

Record IDs can be generated with a number of built-in ID generation functions. These allow for record IDs to be generated using cryptographically-secure randomly-generated identifiers (which are suitable for dispersion across a distributed datastore), sequentially incrementing `ULID` Record identifiers, and `UUID` version 7 Record idenfitifiers.

```surql
// Generate a random record ID
// Charset: `abcdefghijklmnopqrstuvwxyz0123456789`
// ID Length: 20 characters long
CREATE temperature SET time = time::now(), celsius = 37.5;
// :rand() is the default random ID format, so this
// is identical to the above CREATE statement
CREATE temperature:rand() SET time = time::now(), celsius = 37.5;
// Generate a ULID-based record ID
CREATE temperature:ulid() SET time = time::now(), celsius = 37.5;
// Generate a UUIDv7-based record ID
Expand Down
18 changes: 17 additions & 1 deletion src/content/doc-surrealql/statements/create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ CREATE person SET age = 46, username = "john-smith" RETURN BEFORE;
CREATE person SET age = 46, username = "john-smith" RETURN AFTER;
```

You can also return specific fields from a created record, as well as ad-hoc fields to modify the output as needed.
You can also return specific fields from a created record, the value of a single field using `VALUE`, as well as ad-hoc fields to modify the output as needed.

```surql
CREATE person
Expand All @@ -328,9 +328,15 @@ RETURN
age,
interests,
age + 1 AS age_next_year;
CREATE |person:5|
SET age = 20
RETURN VALUE age;
```

```surql title="Response"
-------- Query --------
[
{
age: 46,
Expand All @@ -341,6 +347,16 @@ RETURN
]
}
]
-------- Query --------
[
20,
20,
20,
20,
20
]
```

### Timeout
Expand Down
Loading

0 comments on commit 63d06ae

Please sign in to comment.