dataStore.DocumentMetadata

Note:

The content in this help topic pertains to SuiteScript 2.1.

Object Description

Contains information about the document: its size in bytes and its version.

The API manages this metadata. Both DocumentMetadata.byteLength and DocumentMetadata.version are read-only properties.

Access document metadata as follows:

Supported Script Types

Server scripts

Module

N/dataStore Module

Methods and Properties

DocumentMetadata Object Members

Since

2026.2

DocumentMetadata Object Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Property

DocumentMetadata.byteLength

number

Server scripts

The size of the normalized JSON document body in bytes.

Property

DocumentMetadata.version

string

Server scripts

The stored document's version.

Syntax

Important:

The following code sample shows the syntax for this member. It isn't a functional example. For a complete script example, see N/dataStore Module Script Samples.

            // Add additional code
...

const collection = dataStore.getCollection('checkpoints');
const result = await collection.findOne({ status: 'pending' });

if (result.metadata !== null) {
    const metadata = result.metadata;
    const byteLength = metadata.byteLength;
    const version = metadata.version;
}

...
// Add additional code 

          

General Notices