无法找到MapReduceOptionsBuilder()。 MongoDb加入集合

时间:2016-06-21 08:46:32

标签: c# mongodb mongodb-query mongodb-.net-driver

我正在尝试在我的c#代码中加入两个mongoDB集合。并尝试关注this示例。

但我的代码在下一行给出了错误。说无法找到MapReduceOptionsBuilder。

var options = new  MapReduceOptionsBuilder();
options.SetOutput(MapReduceOutput.Inline);
options.SetOutput(MapReduceOutput.Reduce("result"));
var result = cLifeExpectancy.MapReduce(life_expect_map, r, options);
result = cEconomicAssistance.MapReduce(us_econ_map, r, options);

我在我的项目中有以下Nuget安装:

  1. MongoDB.Bson
  2. MongoDB.Driver
  3. MongoDB.Driver.core
  4. 添加了参考文献。

    using MongoDB.Bson;
    using MongoDB.Bson.Serialization.Attributes;
    using MongoDB.Driver;
    using MongoDB.Driver.Builders;
    

    有人能告诉我我错过了什么吗?或者分享一些在C#.net中加入MongoDB集合的其他例子。或替代MapReduceOptionsBuilder。

1 个答案:

答案 0 :(得分:0)

可能是因为该课程已过时。除非您使用旧版本的驱动程序

http://api.mongodb.com/csharp/1.11/html/ebbdbd35-63b2-7656-aca9-8c13a8c57aa4.htm

链接下面的

有一个如何使用MapReduceOptions的例子。

希望这有助于MongoDB C# driver 2.0: How to get the result from MapReduceAsync