【问题标题】:MapReduceOptionsBuilder() couldnot be found. MongoDb join collections找不到 MapReduce OptionsBuilder()。 MongoDb 加入集合
【发布时间】:2016-06-21 08:46:32
【问题描述】:

我正在尝试在我的 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

添加了以下参考资料。

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

谁能告诉我我错过了什么?或分享一些在 C#.net 中加入 MongoDB 集合的其他示例。或 MapReduceOptionsBuilder 的替代方案。

【问题讨论】:

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


    【解决方案1】:

    可能是因为那个类已经过时了。除非您使用的是旧版驱动程序

    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

    【讨论】:

    • 它仍然说“MapReduceOptionsBuilder”是绝对的。改用“MapReduceArgs”。如何使用 MapReduceArgs 获得相同的结果。
    • 在答案中添加了链接
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-18
    相关资源
    最近更新 更多