Show all posts

Show all posts

October 1, 2022

Release v1.0.0-beta.8


  • Improve HTTP request error messages
  • Add support for dynamic expressions in Record IDs
  • Add support for PERMISSIONS clauses to be separated by commas or spaces
  • Allow deep-merging in UPDATE ... MERGE statements
  • Add debug and trace logging for authentication attempts
  • Make validation and parsing functions more robust with certain edge cases
  • Ignore empty or blank lines when using the SurrealDB SQL REPL
  • Use a dedicated executor thread for CPU-intensive functions
  • Ensure server listens to, and gracefully exits, on SIGINT/SIGTERM signals
  • Add duration functions for calculating durations as specific units
  • Add support for calculating the duration between two datetime values
  • Improve error message when automatically creating a table without authorization
  • Add support for uppercase and lowercase object keys in JWT authentication tokens
  • Allow namespaced claim aliases in JWT token using full domain-specific key names
  • Add support for retrieving JWT authentication token contents using $token parameter
  • Add support for different content return types on /signup and /signin HTTP routes
  • Add session::token() function for retrieving the contents of the JWT authentication token
  • Ensure NONE and NULL values are not automatically cast to another type when updating records
  • Add /health HTTP endpoint for checking the database and data storage engine status
  • Add crypto::bcrypt::generate() and crypto::bcrypt::compare() functions
  • Improve error messages for unique indexes, when inserting records which already exist in the index
  • Add meta::tb() and meta::id() functions for retrieving separate parts of a SurrealDB Record ID
  • Add support for using 3rd party authentication JWTs with DEFINE TOKEN ... ON SCOPE ...

Bug fixes

  • Add support for escaped characters and unicode characters in strings
  • Ensure datetimes work correctly in Eastern timezones
  • Ensure is::uuid() parses valid UUIDs correctly
  • Ensure LET statements throw errors correctly on failure
  • Ensure Record IDs are parsed correctly when defined as a string
  • Fix bug where escaped characters were not supported in regex values
  • Ensure datetimes with milliseconds or nanoseconds are parsed correctly
  • Ensure datetimes with partial timezones are correctly calculated
  • Ensure time::month() returns the month of the specified datetime
  • Ensure FETCH clauses fetch the respective data correctly
  • Handle connection errors properly when WebSocket clients disconnect improperly
  • Ensure HTTP session is not verified multiple times when requesting an invalid HTTP route
  • Use Accept header instead of Content-Type header for client content negotiation
  • Fix key scan range iteration in RocksDB, which caused SurrealDB to randomly crash
  • Ensure authenticated session data is stored after successful scope signup / signin
  • Fix bug where http functions would panic when an invalid URI was specified
  • Ensure correct transaction type (optimistic / pessimistic) was initiated when using TiKV distributed storage engine
  • Ensure math::mean(), math::median(), and math::sqrt() work correctly with empty or zero values
  • Fix bug where MultiPoint, MultiLine, and MultiPolygon geometry values were not formatted correctly
  • Fix bug where defined fields with empty values would be set on the root object, losing the object structure

Performance improvements

  • Miscellaneous performance optimizations and code cleanup
  • Limit maximum allowed runtime and memory in JavaScript functions
  • Ensure crypto and rand functions do not allow unbounded resource usage
  • Ensure read-only transactions are used when write functionality is not needed when using TiKV distributed storage engine

Embedding subquery results

SurrealDB now allows you to use the resulting Record IDs of a subquery, and embed them within another record, without having to specify the id field specifically.

// It is now possible to define a new Record ID as normal
LET $friend = (CREATE person SET name = 'Jaime');
// There is no need to select the `id` field using `$`
CREATE person SET name = 'Tobie', friend = $friend;

Using specific Record IDs

SurrealDB now supports the ability to set a specific reocrd ID in the record content itself when creating records using CREATE and RELATE statements.

// It is now possible to define a new Record ID as normal
CREATE person:test SET name = 'Tobie';
// Or by specifying the Record ID within the record data part of the query
CREATE person SET id = person:test, name = 'Tobie';
// In addition the ID can be specified in a CONTENT object
CREATE person CONTENT { id: person:test, name: 'Tobie' };
// Numbers can be used, and will be converted into a Record ID
CREATE user CONTENT { id: 1, name: 'Robert' };
// Strings can be used, and will be converted into a Record ID
CREATE city CONTENT { id: 'London', name: 'London' };
// UUIDs can be used, and will be converted into a Record ID
CREATE city CONTENT { id: '8e60244d-95f6-4f95-9e30-09a98977efb0', name: 'London' };
// Complex values can be used, and will be converted into a Record ID
CREATE temperature CONTENT { id: ['London', time::now()], name: 'London' };
// Complex values can be used, and will be converted into a Record ID
RELATE person:tobie->knows->person:jaime SET id = knows:cofounder;

Support for deep-merge record updates

SurrealDB now supports deep-merging record changes, ensuring that only specified object fields are modified and overwritten.

// Create a record
CREATE person:test SET name.initials = 'TMH', name.first = 'Tobie', name.last = 'Morgan Hitchcock';
// Use the MERGE clause to deep merge objects, without overwriting any fields
UPDATE person:test MERGE {
  name: {
    title: 'Mr',
    initials: NONE,
  tags: ['Rust', 'Golang', 'JavaScript'],

Dynamic expressions in Record IDs

Complex Record IDs now support dynamic expressions, allowing parameters, and function expressions to be used as values within the IDs. This is useful in a timeseries context, or for ensuring locality between specific records in a table.

// Set a new parameter
LET $now = time::now();
// Create a record with a complex ID using an array
CREATE temperature:['London', $now] SET
  location = 'London',
  date = $now,
  temperature = 23.7
// Create a record with a complex ID using an object
CREATE temperature:{ location: 'London', date: $now } SET
  location = 'London',
  date = $now,
  temperature = 23.7
// Select a range of records up to the current time
SELECT * FROM temperature:['London', '2022-08-29T08:03:39']..['London', time::now()];


Other blog posts

10,000 thank yous!

September 17, 2022

10,000 thank yous!

⭐ 10,000 GitHub stars in 4 weeks! We are utterly blown away! Thank you so, so much to the SurrealDB and dev communities for your amazing support! This is only the start of the SurrealDB journey! We have so much more to come! ⭐

We are hiring!

November 25, 2022

We are hiring!

We are a startup with an ambitious mission to build the ultimate multi-model database for tomorrow’s applications. We are seeking to hire the best - people who care deeply about the work they do, and care about the people with whom they create and promote the product.

To stay up-to-date with new blog articles, future product releases, and documentation updates, subscribe to our email newsletter below, follow us on Twitter, or follow us on Dev.

Join the SurrealDB newsletter