Interface TableInsertManyResult<PKey>

Overview

Represents the result of an insertMany command on a Table.

Example

try {
const result = await table.insertMany([
{ id: uuid.v4(), name: 'John'},
{ id: uuid.v7(), name: 'Jane'},
]);
console.log(result.insertedIds);
} catch (e) {
if (e instanceof TableInsertManyError) {
console.log(e.insertedIds())
console.log(e.errors())
}
}

The primary key type

The type of the primary key of the table is inferred from the second type-param of the Table.

If not set, it defaults to Partial<RSchema> to keep the result type consistent.

💡Tip: See the SomePKey type for more information, and concrete examples, on this subject.

See

  • Table.insertMany
  • TableInsertManyOptions
interface TableInsertManyResult<PKey> {
    insertedCount: number;
    insertedIds: PKey[];
}

Type Parameters

Properties

insertedCount: number

The number of documents that were inserted into the table.

This is always equal to the length of the insertedIds array.

insertedIds: PKey[]

The primary key of the inserted (or upserted) row. These will be the same values as the primary keys which were present in the rows which were just inserted.

See TableInsertManyResult for more information about the primary key.