Questions tagged [surrealdb]

SurrealDB is an innovative NewSQL cloud database, suitable for serverless applications, jamstack applications, single-page applications, and traditional applications. It is unmatched in its versatility and financial value, with the ability for deployment on cloud, on-premise, embedded, and edge computing environments. For a hassle-free setup, get started with SurrealDB Cloud in one-click.

More info can be found here: https://surrealdb.com/

A highly-scalable NewSQL database

SurrealDB is a flexible, developer-friendly, fully ACID transactional, realtime document-graph web database for serverless applications. Never again worry about database provisioning, scaling, sharding, replication, or correctness.

Single-node or distributed

SurrealDB can be run in on a single-node (both in-memory or using durable on-disk storage), or in a highly-available distributed cluster. It consumes very few resources making it perfect for embedding within other stacks or applications.

Flexible data modelling

Using an advanced query language, SurrealDB lets you store and access data using relational, document, graph, and embedded methodologies. The innovative data model enables you to model and access links between data records in an efficient way without complicated JOINs.

Distributed ACID transactions

Have peace-of-mind when working with your data, by using strictly serialisable multi-table and multi-record transactions, with no limit on the number of keys or documents, or the transaction duration.

Built with Rust

SurrealDB is designed from the ground up to be stable and scalable, with a focus on performance and functionality. When running, SurrealDB uses minimal machine resources, with highly-efficient memory access and caching.

Structured and unstructured data

SurrealDB doesn't force you into using pre-specified columns or fields. You can specify that a table is schemaless allowing any data keys to be stored, or instead, schemafull mode ensures that only certain fields and data types can be stored.

Query using SQL

The primary method of querying SurrealDB is using SurrealQL, a similar but modified version of traditional SQL. SurrealQL enables linked documents to be traversed and queried efficiently, while still using an imperative language which remains understandable by data scientists.

GraphQL, REST, or WebSockets

When connecting directly from an end-user device, you can choose to query the data using SurrealQL, GraphQL, or using a traditional REST API. In addition, WebSockets enable high-performance bi-directional realtime syncing of any updated data.

Multi-column indexing on-the-fly

Indexes can be easily added and removed as your application evolves. Indexes allow for strongly consistent reads and writes, enabling highly-performant reads, whilst multi-column unique indexes ensure custom data guarantees.

Full-text indexing with no effort

In SurrealDB, records can be indexed automatically using distributed full-text-indexes, allowing for performant Lucene-based querying over all record data fields, including boolean searches, fuzzy searches, wildcard searches, range searches, and weighted results.

Incrementally computed views

In addition to traditional indexes, SurrealDB allows data to be selected, grouped, and ordered into pre-computed views. These views enable efficient data access for specific incrementally aggregated analytics queries.

Real-time data syncing

When connecting with SurrealDB, all connections are made using WebSockets, allowing for bi-directional data syncing. Dependent on data access permissions, client-based document subscriptions are triggered in real-time whenever changes are made to the data.

In-built access and permissions

SurrealDB is designed as a web database, with clients connecting directly to it from browsers, mobile devices, and desktop apps. Configure your access rules easily using SQL statements, ensuring only the correct users have access to their respective data.

Web-native secure access

With support for SSL/TLS, Single-Sign-On, external 3rd party authentication, JWT token based authentication, and custom business authentication logic - SurrealDB offers strong security, with the flexibility of custom authentication methods that suit your app or business.

Versioned temporal data

Temporal queries enable easy auditing of whole datasets. See how your data, and the graph, evolved over time, and what changes were made by whom - by specifying a certain timestamp when running a query.

Multi-tenant databases

With support for namespaces and databases, SurrealDB enables you to separate your data out however you wish, simplifying the development of SaaS applications.

Global low-latency

Choose where you want your data to reside, and serve customers anywhere - with consistent data, replicated in real-time across multiple regions, allowing you to keep application loading speeds super-fast.

Hands-free elasticity

When using SurrealDB in the cloud, transparent behind-the-scenes scaling ensures that your apps never run out of capacity or storage, while you pay only for the data storage that you use.

Hassle free operation

SurrealDB is built from the ground-up to run as a cloud-first database. Configurable with just a single command, either as a binary, or from within a Docker instance, SurrealDB is easy to start, easy to scale, and easy to maintain. All the hard work is done for you.

62 questions
2
votes
3 answers

How to specify a namespace when using websockets with surrealdb

Edit: I'm no longer trying to do this. Now I just use the surrealdb rust client with the protocol-ws feature flag. I'm connecting to surreal db's /sql endpoint with a websocket. The http docs say to NS and DB http headers, but my WebSocket library…
matiu
  • 7,469
  • 4
  • 44
  • 48
2
votes
1 answer

Rewriting a SQL query into SurrealQL

I've been rewriting some old SQL problems from university in SurrealQL to learn surrealDB but after days of thinking I can't solve this problem: Find all students and professors from the same department that share a birthday This is how this can…
Ali Qanbari
  • 2,923
  • 1
  • 12
  • 28
2
votes
2 answers

Where is the database stored in surrealDB?

It doesn't say in the documentation.
1
vote
1 answer

SurrealDB: describe the table

In MySQL, we would do something like: SHOW CREATE TABLE . How does one achieve the same using surrealQL ?
Marco Antonio
  • 143
  • 1
  • 14
1
vote
1 answer

Rust store DB connection globally

I want to use surrealdb in my rust code without needing a static mut (unsafe code) and without creating a new connection for everything. For example, using static mut: static mut db: Option = None #[tokio::main] async fn main() { unsafe…
1
vote
2 answers

How to connect to a secure WebSocket SurrealDB instance over HTTPS via nginx?

I'm trying to solve this problem I've been experiencing wherein I've been unable to connect to my SurrealDB backend over HTTPS/WSS. When attempting to connect via HTTP or WS, things work just fine, but adding any sort of SSL seems to break…
Z8MB1E
  • 21
  • 5
1
vote
1 answer

SurrealDB functions within CONTENT statement

Is it possible to use the "time::now()" function when doing a CONTENT statement? E.g. CREATE stuff CONTENT $data; $data being a rust BTreeMap. At the moment its inserting the string of "time::now()" rather then running the function at the time of…
Peter I
  • 843
  • 1
  • 9
  • 31
1
vote
2 answers

Surreal DB - Sign up doesn't validate if user already exists and sign in works with any random credentials?

I have created a scope as follows: CURL POST /sql: DEFINE SCOPE user SESSION 1d SIGNUP ( CREATE user SET user = $user, pass = crypto::argon2::generate($pass) ) SIGNIN ( SELECT * FROM user WHERE user = $user AND…
Shivam Sahil
  • 4,055
  • 3
  • 31
  • 62
1
vote
1 answer

Surreal DB - Function to return decoded JWT token?

When I sign in to surreal DB, the action succeeds and I receive an encrypted JWT: { "code": 200, "details": "Authentication succeeded", "token":…
Shivam Sahil
  • 4,055
  • 3
  • 31
  • 62
1
vote
1 answer

Surreal DB - Query from Sets

I have created an author user in surreal DB like this: CREATE author:shivam SET name.first = 'Shivam', name.last = 'Sahil', name.full = string::join(' ', name.first, name.last), age = 23, admin = true, signup_at =…
Shivam Sahil
  • 4,055
  • 3
  • 31
  • 62
1
vote
1 answer

Traverse relations upwards in SurrealDB

The question: How do I use the arrow syntax from surrealdb in the right way, so that I can traverse the relation tree? I can't find good examples on google and the documentation does not explain it in detail. Not enough for me though. What I have: I…
Suppenterrine
  • 55
  • 1
  • 7
1
vote
0 answers

Update surrealDB data error,output info:Failed to resolve lock

I run SurrealDB server with Docker,start command:"docker run --rm -p 8000:8000 docker.io/surrealdb/surrealdb:latest start --log trace --user root --pass root tikv://10.206.0.9:2379",specifying the TiKV cluster endpoint as the backing data…
Tiansi Liu
  • 41
  • 2
1
vote
1 answer

How do I use options in a SurrealDB instance started with Docker?

According to the documentation, you can use a bunch of options (like --log, --user, etc.) to start a SurrealDB instance if it's installed locally. But can I use flag options if I want to use the Docker image? I´ve tried running docker container run…
Tovar
  • 99
  • 2
  • 6
1
vote
3 answers

Authentication Error in NodeJS Integration SurrealDB

I have recently come across SurrealDB, and installed it. After adding to path, I started the server using surreal start --log trace --user root --pass root .d8888b. 888 8888888b. 888888b. d88P Y88b …
Jaideep Shekhar
  • 808
  • 2
  • 7
  • 21
1
vote
0 answers

Can't grab data if not signed in to a scope

I have the following query I ran with surrealdb: DEFINE TABLE school SCHEMAFULL PERMISSIONS FOR select WHERE true; DEFINE FIELD name ON TABLE school TYPE string ASSERT is::ascii($value); DEFINE INDEX name ON TABLE school COLUMNS name…
LeoDog896
  • 3,472
  • 1
  • 15
  • 40