Skip to main content
Skip table of contents

Document data type

The Document data type is modeled after BSON. Documents are quite flexible, and complex hierarchies are supported. There are are few caveats:

  • MongoDB limits nesting depth to 100. 

  • Each document is limited to a size of 16MB in its serialized form.

Data Management automatically converts Document fields to and from JSON Unicode strings. While this mostly follows the JSON conventions, the BSON types that are not directly supported in JSON are rendered as JSON sub-documents (as described in the MongoDB documentation).

Data Management data type

Example

JSON representation

Notes

TextVar
Unicode

"abcd"

"abcd"

 

Decimal

123.456

{ "$numberDecimal": "123.456" }

 

8-byte Integer

1234567890123

{ "$numberLong": "1234567890123" }

 

DateTime

2018-04-24T14:30:10.100
(Denver timezone)

{ "$date": "1524601811052" }

 

Binary

1234567890ABCDEF
(Hexadecimal)

{ "$binary": "EjRWeJCrze8=" }

Base64 encoding.

Date

2018-04-24

 

No natural representation, but Data Management tools can convert to/from string.

Time

14:30:10.100

 

No natural representation, but Data Management tools can convert to/from string.

Spatial

n/a

n/a

 

Binary
(containing ObjectID)

n/a

{ "$oid" : "5aaa9a6510fa17c3390565d4" }

Data Management will convert an _id field containing MongoDB's ObjectID type to/from a 16-byte Binary field.

Document fields are directly read from and written to the DLD file format and the MongoDB connector tools.

Document type conversions

An implicit conversion is one where a field of type Document is assigned to a field of another type, or vice-versa. This usually occurs in the context of the Calculate tool. Data Management supports the following implicit conversions:

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

  • Document → Unicode: The Document is formatted as a JSON representation of the BSON document.

  • Document → TextVar: The Document is converted to Unicode, and than to TextVar.  May result in replacement of some code points with ? characters

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

  • Document → Binary: The Document data is formatted into Unicode as per the Document → Unicode conversion, and then the Unicode string is encoded using UTF-8 into bytes.

Explicit conversions can be performed using the Change Field Types tool. Data Management supports the same set of conversions as in implicit conversions.

An invalid conversion (either because of invalid source data, or because the type conversion is not supported) will result in the target field getting an <<ERROR>> value.

JavaScript errors detected

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

If this problem persists, please contact our support.