I have written following code.Code run fine but its not returning any value but my table have more than 500 records. Please do reply ASAP.
- static void Main(string[] args)
- {
- CallMain(args).Wait();
- Console.ReadLine();
- }
-
- static async Task CallMain(string[] args)
- {
- var conString = "myConnectionString";
- var Client = new MongoClient(conString);
- var DB = Client.GetDatabase("DatabaseName");
- var collection = DB.GetCollection<BsonDocument>("TableName");
- using (var cursor = await collection.Find(new BsonDocument()).ToCursorAsync())
- {
- while (await cursor.MoveNextAsync())
- {
- foreach (var doc in cursor.Current)
- {
- Console.WriteLine(doc);
- }
- }
- }