Пример #1
0
        async System.Threading.Tasks.Task FindAll(MongoDB.Driver.IMongoCollection<AlertType>  collection, List<AlertType> results )
        {
            results = new List<AlertType>();

            var filter = new MongoDB.Bson.BsonDocument();
            var count = 0;
            using (var cursor = await collection.FindAsync<AlertType>(filter,null))
            {
                while (await cursor.MoveNextAsync())
                {
                    var batch = cursor.Current;
                    foreach (var document in batch)
                    {
                        // process document
                        count++;

                        results.Add(document);
                    }
                }
            }
        }