Interface TableInsertOneResult<PKey>

Overview

Represents the result of an insertOne command on a Table.

Example

const result = await table.insertOne({
id: '123',
name: 'John'
});

console.log(result.insertedId); // { id: '123' }

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.insertOne
  • TableInsertOneOptions
interface TableInsertOneResult<PKey> {
    insertedId: PKey;
}

Type Parameters

Properties

Properties

insertedId: PKey

The primary key of the inserted (or upserted) row. This will be the same value as the primary key which was present in the row which was just inserted.

See TableInsertOneResult for more information about the primary key.