//let count: number = (await this.model.find({ Id: something.Id }).session(session)).length;//
In this line i am getting a critical bug waring from sonar cloud on this I am using typescript,The error reported is redundant use of await.
//let count: number = (await this.model.find({ Id: something.Id }).session(session)).length;//
In this line i am getting a critical bug waring from sonar cloud on this I am using typescript,The error reported is redundant use of await.
Hi Sanket,
If I am not wrong, you are accessing length
property, which is probably just a number and then awaiting on it. I hardly can understand why using await
in such case.
@Lena - if we take away the outermost parenthesis, its not awaiting .length
.
// original right hand side expression
(await this.model.find({ Id: something.Id }).session(session)).length;
// after taking the outermost parens off
await this.model.find({ Id: something.Id }).session(session)