Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 41b971f

Browse files
committed
chore: Cleans up type declarations for APIs that had ={}
1 parent 22ab182 commit 41b971f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/client.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,14 @@ export class Collection<TSchema = Document> {
261261
*/
262262
async findOne(
263263
filter?: Filter<TSchema>,
264-
options: { projection?: Document; sort?: Document } = {}
264+
options?: { projection?: Document; sort?: Document }
265265
): Promise<DataAPIResponse<Nullable<WithId<TSchema>>>> {
266266
const { data, error } = await this.callApi<{ document: WithId<TSchema> }>(
267267
"findOne",
268268
{
269269
filter,
270-
projection: options.projection,
271-
sort: options.sort,
270+
projection: options?.projection,
271+
sort: options?.sort,
272272
}
273273
);
274274

@@ -360,7 +360,7 @@ export class Collection<TSchema = Document> {
360360
async updateOne(
361361
filter: Filter<TSchema>,
362362
update: UpdateFilter<TSchema> | Partial<TSchema>,
363-
options: { upsert?: boolean } = {}
363+
options?: { upsert?: boolean }
364364
): Promise<
365365
DataAPIResponse<{
366366
matchedCount: number;
@@ -371,7 +371,7 @@ export class Collection<TSchema = Document> {
371371
return this.callApi("updateOne", {
372372
filter,
373373
update,
374-
upsert: options.upsert,
374+
upsert: options?.upsert,
375375
});
376376
}
377377

@@ -390,7 +390,7 @@ export class Collection<TSchema = Document> {
390390
async updateMany(
391391
filter: Filter<TSchema>,
392392
update: UpdateFilter<TSchema>,
393-
{ upsert }: { upsert?: boolean } = {}
393+
options?: { upsert?: boolean }
394394
): Promise<
395395
DataAPIResponse<{
396396
matchedCount: number;
@@ -401,7 +401,7 @@ export class Collection<TSchema = Document> {
401401
return this.callApi("updateMany", {
402402
filter,
403403
update,
404-
upsert,
404+
upsert: options?.upsert,
405405
});
406406
}
407407

@@ -420,7 +420,7 @@ export class Collection<TSchema = Document> {
420420
async replaceOne(
421421
filter: Filter<TSchema>,
422422
replacement: WithoutId<TSchema>,
423-
options: { upsert?: boolean } = {}
423+
options?: { upsert?: boolean }
424424
): Promise<
425425
DataAPIResponse<{
426426
matchedCount: number;
@@ -431,7 +431,7 @@ export class Collection<TSchema = Document> {
431431
return this.callApi("replaceOne", {
432432
filter,
433433
replacement,
434-
upsert: options.upsert,
434+
upsert: options?.upsert,
435435
});
436436
}
437437

0 commit comments

Comments
 (0)