From 2c7b18e9dccb55c0fc44314a01e22689dab7a836 Mon Sep 17 00:00:00 2001 From: anabellabuckvar <41971124+anabellabuckvar@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:39:13 -0400 Subject: [PATCH] DOP-4490 fixing find options --- src/repositories/baseRepository.ts | 9 ++------- src/repositories/repoBranchesRepository.ts | 5 ++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/repositories/baseRepository.ts b/src/repositories/baseRepository.ts index 3a6967e28..750a1f83f 100644 --- a/src/repositories/baseRepository.ts +++ b/src/repositories/baseRepository.ts @@ -84,16 +84,11 @@ export abstract class BaseRepository { } } - protected async find( - query: any, - errorMsg: string, - options?: mongodb.FindOptions, - projection?: any - ): Promise { + protected async find(query: any, errorMsg: string, options?: mongodb.FindOptions): Promise { try { return await this.promiseTimeoutS( this._config.get('MONGO_TIMEOUT_S'), - this._collection.find(query, projection, options), + this._collection.find(query, options), errorMsg ); } catch (error) { diff --git a/src/repositories/repoBranchesRepository.ts b/src/repositories/repoBranchesRepository.ts index bb79ba4d8..ad8270d71 100644 --- a/src/repositories/repoBranchesRepository.ts +++ b/src/repositories/repoBranchesRepository.ts @@ -34,14 +34,13 @@ export class RepoBranchesRepository extends BaseRepository { async getProdDeployableRepoBranches(directoryPath?: string): Promise { const query = { prodDeployable: true, internalOnly: false }; - const projection = { _id: 0, repoName: 1 }; + const findOptions = { projection: { _id: 0, repoName: 1 } }; const repos = await this.find( query, `Mongo Timeout Error: Timedout while retrieving repo branches entries ${ directoryPath ? `/${directoryPath}` : '' }`, - undefined, - projection + findOptions ); return repos ?? [];