C# 如何分批反序列化RawBsonDocument
对于一些需要加快反序列化速度的边缘情况,我们可以批量并行反序列化吗? 目前我只能一次做一件C# 如何分批反序列化RawBsonDocument,c#,mongodb,C#,Mongodb,对于一些需要加快反序列化速度的边缘情况,我们可以批量并行反序列化吗? 目前我只能一次做一件 List<RawBsonDocument> rawValues = await (await rawCollection.FindAsync(new BsonDocumentFilterDefinition<RawBsonDocument>(new BsonDocument()))) .ToListAsync(); List<Foo> foos= r
List<RawBsonDocument> rawValues =
await (await rawCollection.FindAsync(new BsonDocumentFilterDefinition<RawBsonDocument>(new BsonDocument())))
.ToListAsync();
List<Foo> foos= rawValues.AsParallel().WithDegreeOfParallelism(2)
.Select(r => BsonSerializer.Deserialize<Foo>(r.ToBson())).ToList();
列出原始值=
wait(wait rawCollection.FindAsync(新的BsonDocumentFilterDefinition(新的BsonDocument()))
.ToListAsync();
List foos=rawValues.AsParallel()。带degreeOfParallelism(2)
.Select(r=>BsonSerializer.Deserialize(r.ToBson()).ToList();
Tks