SurrealDB extends the CBOR protocol with a number of custom tags to support the full range of data types available in SurrealDB. This document provides an overview of the custom tags and their respective values.
Tag | Value |
---|---|
Table name | |
UUID (string) | |
Decimal (string) | |
Datetime (compact) | |
Duration (string) | |
Duration (compact) | |
Future (compact) | |
UUID (binary) | |
A datetime represented in an ISO 8601 string.
Adopted from the Iana Specification.
Note: Tag 12 is preferred and always sent back by SurrealDB.
Represents a NONE
value. The value passed to the tagged value is null
, as it cannot be empty.
A table name, represented as a string.
A Record ID, represented as an two-value array, containing a table part (string) and an id part (string, number, object or array).
Instead of an two-value array, SurrealDB also accepts a string with a string-formatted Record ID. A string Record ID will never be sent back from SurrealDB, however.
A UUID represented in a string format.
Note: Tag 37 is preferred and always sent back by SurrealDB.
A Decimal represented in a string format.
A Datetime represented in a two-value array, containing seconds (number) and optionally nanoseconds (number).
A Duration represented in a string format.
Note: Tag 14 is preferred and always sent back by SurrealDB.
A Duration repesented in a two-value array, containing optionally seconds (number) and optionally nanoseconds (number). An empty array will be considered a duration of 0.
A Future represented as a string containing the uncomputed SurrealQL query or expression. The value transported needs to be returned in an Object
in a {}
, this will also be the format you receive it in from SurrealDB this will allow for it to be computed when accedded or used within a query.
A UUID represented in a binary format. Please reference (https://docs.rs/uuid/latest/uuid/struct.Uuid.html#method.as_bytes).
Adopted from the Iana Specification.
A Range represented as a two-value array containing optional bounds. Each bound can be either null (for unbounded), or a tagged value using either Tag 50 (included bound) or Tag 51 (excluded bound).
The bounds follow SurrealQL’s range syntax where ..
represents a range, >..
represents an excluded lower bound, and ..=
represents an included upper bound.
An included bound value used within Range bounds. The tagged value represents an inclusive boundary (equivalent to ..=
for upper bounds in SurrealQL range syntax).
An excluded bound value used within Range bounds. The tagged value represents an exclusive boundary (equivalent to >..
for lower bounds in SurrealQL range syntax).
A Geometry Point represented by a two-value array containing a longitude (float) and latitude (float).
A Geometry Line represented by an array with two or more points (Tag 88).
A Geometry Polygon represented by an array with one or more closed lines (Tag 89).
If the lines are not closed, meaning that the first and last point are equal, then SurrealDB will automatically suffix the line with it’s first point.
A Geometry MultiPoint represented by an array with one or more points (Tag 88).
A Geometry MultiLine represented by an array with one or more lines (Tag 89).
A Geometry MultiPolygon represented by an array with one or more polygons (Tag 90).
A Geometry Collection represented by an array with one or more geometry values (Tag 88, Tag 89, Tag 90, Tag 91, Tag 92, Tag 93 or Tag 94).