Skip to content

Commit

Permalink
DOP-4490 fixing find options
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Mar 28, 2024
1 parent 24c8bd2 commit 2c7b18e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/repositories/baseRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,11 @@ export abstract class BaseRepository {
}
}

protected async find(
query: any,
errorMsg: string,
options?: mongodb.FindOptions,
projection?: any
): Promise<mongodb.FindCursor> {
protected async find(query: any, errorMsg: string, options?: mongodb.FindOptions): Promise<mongodb.FindCursor> {
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) {
Expand Down
5 changes: 2 additions & 3 deletions src/repositories/repoBranchesRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ export class RepoBranchesRepository extends BaseRepository {

async getProdDeployableRepoBranches(directoryPath?: string): Promise<any> {
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 ?? [];
Expand Down

0 comments on commit 2c7b18e

Please sign in to comment.