I am using MongoDB on C# and trying to do simple query. Program execution terminates on lines like:
var people = await collection.Find(filter).ToListAsync();
or on line
using (var cursor = await collection.FindAsync(filter))
It trows no exceptions, it has Console.WriteLine("test") and Console.ReadLine() at the end of the program which are not executed. In cmd I see that connection to DB is established.
Any ideas?
P.S.
var filter = Builders<Follower>.Filter.Eq("id", f.id);
List<Follower> fetchedFollowers = new List<Follower>();
Console.WriteLine("0");
try
{
using (var cursor = await collection.FindAsync(filter))
{
Console.WriteLine("1");
while (await cursor.MoveNextAsync())
{
var batch = cursor.Current;
foreach (Follower foll in batch)
fetchedFollowers.Add(foll);
}
}
}
catch (Exception e)
{
Console.WriteLine("Exception block");
Console.WriteLine("2");
}
Console.WriteLine("3");
Console.ReadLine();
Update. This line:
var count = await collection.Find(filter).CountAsync();
gives the same result - program terminates