0
I made a api
in C#
and it’s the first time I’ve used Mongo as a bank and on a route I need to get the total records I have on my Collection
.
I tried several ways but could not find a way to return a number int
and doing some research I found this way but it returns me a long kind.
private async Task<long> CountVacancyAsync()
=> await _collection.Find(x => x.Activy.Equals(true) || x.Activy.Equals(false))
.CountDocumentsAsync();
Is there any more correct way to return the total records and needs to be the same type long
?