diff --git a/packages/runtime/src/client/crud/operations/find.ts b/packages/runtime/src/client/crud/operations/find.ts index ef2b60be..e0d2440f 100644 --- a/packages/runtime/src/client/crud/operations/find.ts +++ b/packages/runtime/src/client/crud/operations/find.ts @@ -8,15 +8,19 @@ export class FindOperationHandler extends BaseOperatio const normalizedArgs = this.normalizeArgs(args); // parse args - const parsedArgs = validateArgs + const parsedArgs = (validateArgs ? this.inputValidator.validateFindArgs(this.model, operation === 'findUnique', normalizedArgs) - : normalizedArgs; + : normalizedArgs) as FindArgs, true>; + + if (operation === 'findFirst') { + parsedArgs.take = 1; + } // run query const result = await this.read( this.client.$qb, this.model, - parsedArgs as FindArgs, true>, + parsedArgs, ); const finalResult = operation === 'findMany' ? result : (result[0] ?? null);