Skip to content
On this page

stratadb / InsertManyResult

Type Alias: InsertManyResult<T>

ts
type InsertManyResult<T> = object;

Defined in: src/collection-types.ts:44

Result of inserting multiple documents into a collection.

Remarks

Contains all successfully inserted documents with their generated IDs and count. Since SQLite is ACID and local, if this function returns without throwing, all inserts succeeded.

Example

typescript
const result = await users.insertMany([
  { name: 'Alice', email: 'alice@example.com' },
  { name: 'Bob', email: 'bob@example.com' }
]);
console.log(`Inserted ${result.insertedCount} users`);
console.log('User IDs:', result.documents.map(d => d._id));

Type Parameters

T

T extends Document

The document type

Properties

documents

ts
readonly documents: readonly T[];

Defined in: src/collection-types.ts:46

Array of inserted documents with their generated IDs


insertedCount

ts
readonly insertedCount: number;

Defined in: src/collection-types.ts:49

Number of documents successfully inserted

Released under the MIT License.