Mongo db c# 驱动程序 - 如何通过 id 加入集合?

Mongo db c# driver - how to join by id in collection?

我正在使用 Mongo DB c# 驱动程序 2, 我正在尝试 按 ID(多对多)加入 2 个集合

Class A
{
   public string id;
   public string name;
   public list<string> classBReferenceid; // <--- I want use this as the "keys" for the join
   public list<B> myBs;
}
Class B
{
   public string id; // <--- I use this as the "key" for the join
   public string name;
}

在我的数据库中 class "A" 保存时没有 "myBs" 的数据,我想在一次调用中从 mongo 中提取它。

我尝试使用查找功能:

IMongoCollection<A> mongoACollection = // already set in driver....
IMongoCollection<B> mongoBCollection = // already set in driver....

IAggregateFluent<A> results = _mongoACollection.Aggregate().
                Lookup<A, B, A>(
                    mongoBCollection,
                    a => a.classBReferenceid,
                    b => b.Id,
                    a => a.myBs);

但它不起作用(不加入任何东西)可能是因为 "classBReference" 是一个列表而不是 "id"。

我如何使用 Lookup 通过出现在另一个集合的 ID 列表中的 ID 加入一个集合?

此功能是在 MongoDb v3.3.4 中引入的,但我的本地实例通过 Mongo2Go 使用 MongoDb 3.2,我将其用于单元测试。

将本地实例升级到 v3.3.4 后,问题就解决了。