Skip to main content
Version: 2.x(alpha)

CBOR

SurrealDB Supports the CBOR protocol, shipped with an additional couple of custom tags.

References:

Tags Overview

TagValue

Tag 0

Datetime (ISO 8601 string)

Tag 6

NONE

Tag 7

Table name

Tag 8

Record ID

Tag 9

UUID (string)

Tag 10

Decimal (string)

Tag 12

Datetime (compact)

Tag 13

Duration (string)

Tag 14

Duration (compact)

Tag 37

UUID (binary)

Tag 88

Geometry Point

Tag 89

Geometry Line

Tag 90

Geometry Polygon

Tag 91

Geometry MultiPoint

Tag 92

Geometry MultiLine

Tag 93

Geometry MultiPolygon

Tag 94

Geometry Collection

Tag 0

A datetime represented in an ISO 8601 string.

Adopted from the Iana Specification.

Note: Tag 12 is preferred and always sent back by SurrealDB.

Tag 6

Represents a NONE value. The value passed to the tagged value is null, as it cannot be empty.

Tag 7

A table name, represented as a string.

Tag 8

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.

Tag 9

A UUID represented in a string format.

Note: Tag 37 is preferred and always sent back by SurrealDB.

Tag 10

A Decimal represented in a string format.

Tag 12

A Datetime represented in a two-value array, containing seconds (number) and optionally nanoseconds (number).

Tag 13

A Duration represented in a string format.

Note: Tag 14 is preferred and always sent back by SurrealDB.

Tag 14

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.

Tag 37

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.

Tag 88

A Geometry Point represented by a two-value array containing a lat (float) and lon (float).

Tag 89

A Geometry Line represented by an array with two or more points (Tag 88).

Tag 90

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.

Tag 91

A Geometry MultiPoint represented by an array with one or more points (Tag 88).

Tag 92

A Geometry MultiLine represented by an array with one or more lines (Tag 89).

Tag 93

A Geometry MultiPolygon represented by an array with one or more polygons (Tag 90).

Tag 94

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