【发布时间】:2022-01-20 00:09:23
【问题描述】:
我想允许DiskUse:true。但是我找不到任何示例来解释为 MongoDB C# 驱动程序启用 allowDiskUse。
如何在 MongoDB C# 驱动程序中启用 allowDiskUse?
我的示例代码就是这样
var pipeline = new[] { match, project, group, limit, sort, allow };
List<SMBMostInfluentialUser> result = db
.GetCollection<SMBTwitterStatus>("TwitterStatus")
.Aggregate(pipeline).ResultDocuments.Select(x =>
new User
{
Influence = Convert.ToDouble(x["Influence"]),
User = new SMBUser((BsonDocument)x["User"])
}).ToList();
【问题讨论】:
-
在此api.mongodb.org/csharp/current/html/… 页面的“属性”部分中,您需要将参数设置为 true 以允许使用磁盘。在执行 db.GetCollection... 查询之前将其设置为 true。
标签: c# mongodb mongodb-.net-driver aggregation-framework