【发布时间】:2014-04-06 21:52:15
【问题描述】:
* 已编辑 * 有人可以帮我在 mongodb 中使用 powershell 创建索引吗?
我正在关注这个create index using c# driver
这是我的代码:
$keys = IndexKeys.Ascending("Message Subject", "Job Result").Descending("Time Stamp")
$options = new-object MongoDB.Driver.IndexOptionsDocument
$options.SetUnique(true)
$notificationCollectionByDate.CreateIndex(keys, options)
我收到以下错误
方法调用失败,因为 [MongoDB.Driver.IndexOptionsDocument] 不包含名为“SetUnique”的方法。
“IndexKeys.Ascending”一词未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查拼写 的名称,或者如果包含路径,请验证该路径是 正确并再试一次。
知道我的代码有什么问题吗?
非常感谢
【问题讨论】:
标签: powershell mongodb-.net-driver