$ open source · GPL-3.0 — need a commercial license? imqueue.com →

BaseModel.findOne() method

Finds the first instance matching the options.

Signature:

static findOne<M>(options?: FindOptions): Promise<M | null>;

Parameters

Parameter

Type

Description

options

FindOptions

(Optional) Find options; viewParams applies to a dynamic view.

Returns:

Promise<M | null>

The instance, or null when no row matches.

Remarks

Sequelize's own findOne with one addition: on a model declared as a view, the numeric columns of the result are cast back to numbers.