Sorting MongoDB data using C#

    Sort is the inbuilt method used to sort the data while retrieving from the MongoDB. Sort is used along with the Find() to fetch the details in Ascending or descending order. We can use both ascending and descending order to single Find() statement.

C# : .Net 4.5 and MongoDriver 2.0

using System;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Core;

namespace RetrSortFilt
    class Program
        static void Main(string[] args)
        static async Task CallMain(string[] args)
            var conString = "mongodb://localhost:27017";
            var Client = new MongoClient(conString);
            var DB = Client.GetDatabase("test");
            var collection = DB.GetCollection<BsonDocument>("store");
            var list = await collection.Find(new BsonDocument())
            foreach (var doc in list)