BaseModel.findByPk() method
Finds one instance by primary key.
Signature:
static findByPk<M>(identifier?: Identifier, options?: Omit<FindOptions, 'where'>): Promise<M | null>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
identifier |
Identifier |
(Optional) Primary key value to look for. |
|
options |
Omit<FindOptions, 'where'> |
(Optional) Find options, minus |
Returns:
Promise<M | null>
The instance, or null when no row matches.
Remarks
Sequelize's own findByPk with one addition: on a model declared as a view, the numeric columns of the result are cast back to numbers.