Skip to content

Commit b2c361e

Browse files
committed
review comment cleanup
1 parent 44509b6 commit b2c361e

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/collection.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,18 @@ export class Collection<TSchema extends Document = Document> {
501501
*/
502502
async findOne(): Promise<WithId<TSchema> | null>;
503503
async findOne(filter: Filter<TSchema>): Promise<WithId<TSchema> | null>;
504-
async findOne(filter: Filter<TSchema>, options: FindOptions): Promise<WithId<TSchema> | null>;
504+
async findOne(
505+
filter: Filter<TSchema>,
506+
options: Omit<FindOptions, 'timeoutMode'>
507+
): Promise<WithId<TSchema> | null>;
505508

506509
// allow an override of the schema.
507510
async findOne<T = TSchema>(): Promise<T | null>;
508511
async findOne<T = TSchema>(filter: Filter<TSchema>): Promise<T | null>;
509-
async findOne<T = TSchema>(filter: Filter<TSchema>, options?: FindOptions): Promise<T | null>;
512+
async findOne<T = TSchema>(
513+
filter: Filter<TSchema>,
514+
options?: Omit<FindOptions, 'timeoutMode'>
515+
): Promise<T | null>;
510516

511517
async findOne(
512518
filter: Filter<TSchema> = {},

src/gridfs/download.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@ function init(stream: GridFSBucketReadStream): void {
401401
`Download timed out after ${stream.s.timeoutContext?.timeoutMS}ms`
402402
);
403403
} catch (error) {
404-
if (!stream.destroyed)
405-
stream.destroy(error);
404+
if (!stream.destroyed) stream.destroy(error);
406405
return;
407406
}
408407

src/gridfs/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { type Filter, TypedEventEmitter } from '../mongo_types';
77
import type { ReadPreference } from '../read_preference';
88
import type { Sort } from '../sort';
99
import { CSOTTimeoutContext } from '../timeout';
10+
import { resolveOptions } from '../utils';
1011
import { WriteConcern, type WriteConcernOptions } from '../write_concern';
1112
import type { FindOptions } from './../operations/find';
1213
import {
@@ -155,7 +156,7 @@ export class GridFSBucket extends TypedEventEmitter<GridFSBucketEvents> {
155156
* @param id - The id of the file doc
156157
*/
157158
async delete(id: ObjectId, options?: { timeoutMS: number }): Promise<void> {
158-
const timeoutMS = options?.timeoutMS ?? this.s.db.timeoutMS;
159+
const { timeoutMS } = resolveOptions(this.s.db, options);
159160
let timeoutContext: CSOTTimeoutContext | undefined = undefined;
160161

161162
if (timeoutMS) {
@@ -235,7 +236,7 @@ export class GridFSBucket extends TypedEventEmitter<GridFSBucketEvents> {
235236

236237
/** Removes this bucket's files collection, followed by its chunks collection. */
237238
async drop(options?: { timeoutMS: number }): Promise<void> {
238-
const timeoutMS = options?.timeoutMS ?? this.s.db.timeoutMS;
239+
const { timeoutMS } = resolveOptions(this.s.db, options);
239240
let timeoutContext: CSOTTimeoutContext | undefined = undefined;
240241

241242
if (timeoutMS) {

src/gridfs/upload.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,7 @@ async function checkIndexes(stream: GridFSBucketWriteStream): Promise<void> {
345345
{},
346346
{
347347
projection: { _id: 1 },
348-
timeoutMS: remainingTimeMS,
349-
timeoutMode: remainingTimeMS != null ? CursorTimeoutMode.LIFETIME : undefined
348+
timeoutMS: remainingTimeMS
350349
}
351350
);
352351
if (doc != null) {

0 commit comments

Comments
 (0)