Optionalopts: {Optionalcolumn: Raw<any> | ColumnRef<EntitySchema<TEntity>>Optionalcolumn: Raw<any> | ColumnRef<EntitySchema<TEntity>>Look up a single entity by primary key. Returns undefined when no
row matches.
The PK column(s) are resolved automatically from the entity's schema
via the primaryKey / hasPrimaryKey extensions. Composite PKs are
passed as a tuple in declaration order:
await db.todos.find(42); // single PK
await db.userRoles.find([userId, role]); // composite PK
Any chained .include() / .includeVariant() calls on this query
are honoured by the underlying SELECT.
Look up multiple entities by primary key in a single SQL statement.
Returns rows in DB order (no ordering guarantee relative to pks).
For composite PKs each element of pks is a tuple matching
declaration order. Returns [] when pks is empty.
Eager-load a relation declared on TEntity via .hasOne() /
.hasMany() / .belongsTo() / .belongsToMany(). Selector returns
the relation key as a string literal.
Optionalcustomize: (q: SchemaQueryBuilder<any, any>) => voidEager-load a relation declared inside a polymorphic variant (CTI/STI).
The relation is only populated on rows whose discriminator matches
variantKey. Type-level: when relationName is a key of the
entity's relations, it appears only on the matching branch of the
discriminated-union result; otherwise the result type is unchanged.
Optionalcustomize: (q: SchemaQueryBuilder<any, any>) => voidOptionaldirection: "asc" | "desc"Optionalbindings: any[]Optionaloperator: stringOptionalvalue: any
The typed query handle returned by every DbSet method that initiates a query (e.g.
.where(),.include(),.first()).Structurally it IS a SchemaQueryBuilder for the entity's schema, with typed
.include()/.includeVariant()methods overlaid. All otherSchemaQueryBuildermethods are available andthis-returning chains preserve the typed wrapper.