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) | |
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 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 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).