Skip to main content
Skip table of contents

Document functions

Overview

The Document functions support moving data into and out of the Document data type.

AsDocument

Convert value to type Document.

Syntax

AsDocument( value )

The required argument value may of type Unicode, TextVar, or Binary.

Remarks

Data Management converts value using the following implicit field conversion logic:

  • Unicode → Document: The Unicode string is assumed to contain the JSON representation of a BSON document, and is parsed.

  • TextVar → Document: The same as Unicode → Document, but not all code points can be represented.

  • Binary → Document: The Binary data is assumed to contain a UTF-8 encoded string. The Binary data is decoded into a string and then converted as per Unicode → Document.

Example

AsDocument('{"A":"a"}') returns 0E00000002410002000000610000

BSONToDocument

Convert native BSON bytes to type Document.

Syntax

BSONToDocument( binary )

The required argument binary must be native BSON.

Example

BSONToDocument( binary )

DocumentToBSON

Convert Document type to native BSON bytes.

Syntax

DocumentToBSON( document )

The required argument document must be of type Document.

Example

DocumentToBSON( NewDoc )

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.