enum classafBson::BsonType

sys::Obj
  sys::Enum
    afBson::BsonType

@Serializable { simple=true }

A list of BSON types.

@see http://bsonspec.org/spec.html

ARRAY

Source

const static BsonType ARRAY := ...

Maps to List. All vals must be valid BSON types.

BINARY

Source

const static BsonType BINARY := ...

Maps to Binary, or a Buf if the sub-type is BIN_GENERIC.

BOOLEAN

Source

const static BsonType BOOLEAN := ...

Maps to Bool.

CODE

Source

const static BsonType CODE := ...

Maps to Code.

CODE_W_SCOPE

Source

const static BsonType CODE_W_SCOPE := ...

Maps to Code.

DATE

Source

const static BsonType DATE := ...

Maps to DateTime.

DB_POINTER

Source

const static BsonType DB_POINTER := ...

Deprecated, do not use.

DOCUMENT

Source

const static BsonType DOCUMENT := ...

Maps to Map. All keys must be Str and all vals must be valid BSON types.

DOUBLE

Source

const static BsonType DOUBLE := ...

Maps to Float.

EOO

Source

const static BsonType EOO := ...

End-Of-Object. For internal use.

INTEGER_32

Source

const static BsonType INTEGER_32 := ...

CAUTION: INTEGER_32 values will be read as Int values. If you then write its containing document, the storage type will be converted to INTEGER_64.

This is only of concern if other, non Fantom drivers, are writing to the database.

INTEGER_64

Source

const static BsonType INTEGER_64 := ...

Maps to Int.

MAX_KEY

Source

const static BsonType MAX_KEY := ...

Maps to MaxKey. For internal use.

MIN_KEY

Source

const static BsonType MIN_KEY := ...

Maps to MinKey. For internal use.

NULL

Source

const static BsonType NULL := ...

Maps to null.

OBJECT_ID

Source

const static BsonType OBJECT_ID := ...

Maps to ObjectId.

REGEX

Source

const static BsonType REGEX := ...

Maps to Regex.

STRING

Source

const static BsonType STRING := ...

Maps to Str.

SYMBOL

Source

const static BsonType SYMBOL := ...

Deprecated, do not use.

TIMESTAMP

Source

const static BsonType TIMESTAMP := ...

Maps to Timestamp.

UNDEFINED

Source

const static BsonType UNDEFINED := ...

Deprecated, do not use.

fromObj

Source

static new fromObj(Obj? obj, Bool checked := true)

Determines a BSON type from the type of the given object. Throws an ArgErr if invalid.

Obj is needed (as oppose to just the type) because a Code instance may be mapped to either CODE or CODE_W_SCOPE.

fromStr

Source

static new fromStr(Str name, Bool checked := true)

Return the BsonType instance for the specified name. If not a valid name and checked is false return null, otherwise throw ParseErr.

fromValue

Source

static new fromValue(Int value, Bool checked := true)

Throws an ArgErr if invalid.

isBsonLiteral

Source

static Bool isBsonLiteral(Type? type)

Returns true if the given Type is a BSON literal. null and Buf are considered literals, whereas Maps and Lists are not.

BsonType.isBsonLiteral(Int#)      // --> true
BsonType.isBsonLiteral(Code#)     // --> true
BsonType.isBsonLiteral(null)      // --> true

BsonType.isBsonLiteral(List#)     // --> false
BsonType.isBsonLiteral(Str:Obj?#) // --> false
type

Source

const Type? type

The Fantom Type (if any) this BSON type maps to.

vals

Source

const static BsonType[] vals := ...

List of BsonType values indexed by ordinal

value

Source

const Int value

The value that uniquely identifies the type as per the BSON spec.