Code sample 1: IMongoCollection collection = this.GetDbCollection(); var result = await collection.Aggregate() .Match(l => items.Contains(l.CollectionId)) .Group( new BsonDocument { { "_id", "$collectionId" }, { "totalAmount", new BsonDocument { { "$sum", "$totalAmount" } } }, { "ddTotalAmount", new BsonDocument { { "$sum", "$details.ddTotalAmount" } } }, { "checkTotalAmount", new BsonDocument { { "$sum", "$details.checkTotalAmount" } } }, { "totalItemsCount", new BsonDocument { { "$sum", "$totalItemsCount" } } }, { "count", new BsonDocument { { "$sum", 1 } } } }) .ToListAsync(); return result.Select(tot => BsonSerializer.Deserialize(tot.ToBsonDocument())); Code sample 2: IMongoCollection collection = this.GetDbCollection(); var result = await collection.Aggregate() .Match(l => items.Contains(l.CollectionId)) .Group( l => l.CollectionId, g => new LiabilitySetTotals() { Id = g.Key, Count = g.Count(), TotalAmount = g.Sum(l => l.TotalAmount), TotalItemsCount = g.Sum(l => l.TotalItemsCount), DdTotalAmount = g.Sum(l => l.Details.DdTotalAmount), CheckTotalAmount = g.Sum(l => l.Details.CheckTotalAmount) }) .ToListAsync(); return result; --- [BsonIgnoreExtraElements] [Serializable] [DataContract] public class LiabilitySetTotals { /// /// Gets or sets the Collection ID. /// [BsonId] [DataMember] public Guid Id { get; set; } /// /// Gets or sets the total amount. /// [BsonElement("totalAmount")] [BsonRepresentation(BsonType.Double, AllowTruncation = true)] [DataMember] public decimal TotalAmount { get; set; } /// /// Gets or sets the total amount. /// [BsonElement("ddTotalAmount")] [BsonRepresentation(BsonType.Double, AllowTruncation = true)] [DataMember] public decimal DdTotalAmount { get; set; } /// /// Gets or sets the total amount. /// [BsonElement("checkTotalAmount")] [BsonRepresentation(BsonType.Double, AllowTruncation = true)] [DataMember] public decimal CheckTotalAmount { get; set; } /// /// Gets or sets the total pay items count. /// [BsonElement("totalItemsCount")] [DataMember] public int TotalItemsCount { get; set; } /// /// Gets or sets the liabilities count. /// [BsonElement("count")] [DataMember] public int Count { get; set; } public LiabilitySetTotals() { this.Id = Guid.Empty; } }