Datastore.getCollection(id)

Note:

The content in this help topic pertains to SuiteScript 2.1.

Method Description

Returns a dataStore.Collection object for the specified collection in this data store.

This method doesn't read or write stored documents.

Returns

dataStore.Collection

Supported Script Types

Server scripts

Governance

None

Module

N/dataStore Module

Parent Object

dataStore.Datastore

Sibling Object Members

Datastore Object Members

Since

2026.2

Parameters

Parameter

Type

Required / Optional

Description

Since

id

string

required

The identifier of the collection to access.

Use 1-64 ASCII letters, digits, underscores, dots, or hyphens. Collection identifiers are case-insensitive.

2026.2

Errors

Error Code

Error Message

Thrown If

TypeError

The collection identifier must be a string with 1 to 64 ASCII letters, digits, underscores, dots, or hyphens.

The identifier is not a string or does not meet the identifier rules.

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 store = dataStore.getDatastore('processing');
const collection = store.getCollection('checkpoints');

...
// Add additional code 

          

General Notices