I have more than 200K MongoIds in the idsList list.And when executing the below code, it takes more than 1 minute to execute the mongo aggregate function.Please suggest solution to improve the performance or other way to get the result.
var bsonDocument= new BsonDocument
{
{ "_id", BsonNull.Value },
{ "min", new BsonDocument("$min", "$field") }
};
var data= await Collection.Aggregate()
.Match(Builders<Entity>.Filter.In(x => x.Id, idsList))
.Group(bsonDocument)
.FirstOrDefaultAsync(cancellationToken);