我正在通过 .net 框架在 C# 驱动程序 2.10.2(我知道有一个 5 年前的版本)之上为 MongoDB 编写一个 labview 驱动程序。一切都很顺利,直到我想创建获取集合的方法。正如您在图片中看到的,我无法从 IMongoDatabase 对象中获取 GetCollection 方法(但我可以获取 CreateColection ...)。我不知道为什么缺少方法。
我已经从github(tar.gz 文件)下载了源代码。我用 Visual Studio 2019(Release,AnyCPU)编译它,然后获取 DLL。(有两个文件夹,“net452”和“netstandard1.5”。我用两个文件夹中的 DLL 重现了错误。我不知道它们之间的区别)。
我对 C# 一无所知,所以我不知道 DLL 是否正常并且方法在 C# 中是否有效。另外我对 Visual Studio 一无所知,我已经为这个项目专门下载了它来编译代码。所以也许我做了一些愚蠢的事情。我所做的是打开 .sln 文件,选择发布而不是调试,然后单击编译。
任何提示我可以在哪里开始搜索?
非常感谢你的帮助,
赫克托
编辑:我已经从 github 下载了已经编译的 9.2 版本,我遇到了同样的问题。但是,如果我选择旧版驱动程序(在两个版本中)它都可以工作,我有方法 getCollection 用于过时的对象 MongoDatabase 而不是新的 IMongoDatabase。这里发生了什么事?
您可以在这里看到 IMongoDatabase 对象具有 getColletion 方法:
<member name="M:MongoDB.Driver.IMongoDatabase.GetCollection``1(System.String,MongoDB.Driver.MongoCollectionSettings)">
<summary> Gets a collection. </summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="name">The name of the collection.</param>
<param name="settings">The settings.</param>
<returns>An implementation of a collection.</returns>
</member>
