dataStore.InsertManyResult

Note:

The content in this help topic pertains to SuiteScript 2.1.

Object Description

Contains the number of documents inserted and the insertion result for each document.

Returned by Collection.insertMany(documents).

Both properties are read-only.

Supported Script Types

Server scripts

Module

N/dataStore Module

Methods and Properties

InsertManyResult Object Members

Since

2026.2

InsertManyResult Object Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Property

InsertManyResult.inserted

dataStore.InsertOneResult[]

Server scripts

An array of dataStore.InsertOneResult objects, with one element for each document.

Property

InsertManyResult.insertedCount

number

Server scripts

The number of documents inserted.

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.insertMany([
    { status: 'pending' },
    { status: 'ready' }
]);
const insertedCount = result.insertedCount;

for (const inserted of result.inserted) {
    const documentId = inserted.insertedId;
    const metadata = inserted.metadata;
}

...
// Add additional code 

          

General Notices