@@ -261,14 +261,14 @@ export class Collection<TSchema = Document> {
261
261
*/
262
262
async findOne (
263
263
filter ?: Filter < TSchema > ,
264
- options : { projection ?: Document ; sort ?: Document } = { }
264
+ options ? : { projection ?: Document ; sort ?: Document }
265
265
) : Promise < DataAPIResponse < Nullable < WithId < TSchema > > > > {
266
266
const { data, error } = await this . callApi < { document : WithId < TSchema > } > (
267
267
"findOne" ,
268
268
{
269
269
filter,
270
- projection : options . projection ,
271
- sort : options . sort ,
270
+ projection : options ? .projection ,
271
+ sort : options ? .sort ,
272
272
}
273
273
) ;
274
274
@@ -360,7 +360,7 @@ export class Collection<TSchema = Document> {
360
360
async updateOne (
361
361
filter : Filter < TSchema > ,
362
362
update : UpdateFilter < TSchema > | Partial < TSchema > ,
363
- options : { upsert ?: boolean } = { }
363
+ options ? : { upsert ?: boolean }
364
364
) : Promise <
365
365
DataAPIResponse < {
366
366
matchedCount : number ;
@@ -371,7 +371,7 @@ export class Collection<TSchema = Document> {
371
371
return this . callApi ( "updateOne" , {
372
372
filter,
373
373
update,
374
- upsert : options . upsert ,
374
+ upsert : options ? .upsert ,
375
375
} ) ;
376
376
}
377
377
@@ -390,7 +390,7 @@ export class Collection<TSchema = Document> {
390
390
async updateMany (
391
391
filter : Filter < TSchema > ,
392
392
update : UpdateFilter < TSchema > ,
393
- { upsert } : { upsert ?: boolean } = { }
393
+ options ? : { upsert ?: boolean }
394
394
) : Promise <
395
395
DataAPIResponse < {
396
396
matchedCount : number ;
@@ -401,7 +401,7 @@ export class Collection<TSchema = Document> {
401
401
return this . callApi ( "updateMany" , {
402
402
filter,
403
403
update,
404
- upsert,
404
+ upsert : options ?. upsert ,
405
405
} ) ;
406
406
}
407
407
@@ -420,7 +420,7 @@ export class Collection<TSchema = Document> {
420
420
async replaceOne (
421
421
filter : Filter < TSchema > ,
422
422
replacement : WithoutId < TSchema > ,
423
- options : { upsert ?: boolean } = { }
423
+ options ? : { upsert ?: boolean }
424
424
) : Promise <
425
425
DataAPIResponse < {
426
426
matchedCount : number ;
@@ -431,7 +431,7 @@ export class Collection<TSchema = Document> {
431
431
return this . callApi ( "replaceOne" , {
432
432
filter,
433
433
replacement,
434
- upsert : options . upsert ,
434
+ upsert : options ? .upsert ,
435
435
} ) ;
436
436
}
437
437
0 commit comments