求救,C# mongoDB聚合数据后,如何转换为指定的 对象List
例如:
从AnswerRecord 表中聚合出 count和 paperId等信息的List<TDocument>
转换为一个 指定的 List<Count>.
如下,我通过 ToList获得了一个List
想把这个List转为指定的 对象List
麻烦大佬们了
`
var pipeCount = mRoot.answerRecord.GetAggregate().Match(x => x.userId == userId && x.subjectId == subjectId && x.visiable == 1)
.Sort(BsonDocument.Parse("{ $sort: { 'mtime' : -1 } }"))
.Group(BsonDocument.Parse("{ $group: { '_id' : {'cate':'$cate','paperId':'$paperId','sectionId':'$sectionId'} } }"))
.Count().ToList();
`
public IAggregateFluent<T> GetAggregate() => Collection.Aggregate();
`
public IMongoCollection<T> Collection { get; }
`