【发布时间】:2016-10-20 00:16:06
【问题描述】:
我知道如何在 SQL 世界中做到这一点,但试图在 RavenDB 领域解决这个问题。
我有 2 个这样的课程:
public class Client
{
public string Id {get;set;}
public string Name {get;set;}
}
public class WaitingListEntry
{
public string Id {get;set;}
public string ClientId {get;set;}
public string OtherDocumentInformation {get;set;}
}
还有一个相当简单的 map/reduce:
AddMap<Client>(clients => from c in clients select new { Id = (string)null, ClientId = c.ClientId, Name = c.Name });
AddMap<WaitingListEntry>(wls => from wl in wls select new { Id = wl.Id, ClientId = wl.ClientId, Name = (string)null });
Reduce = results => from result in results
group result by result.ClientId
into g
select new { Id = g.Select(x => x.Id).Where(x => x != null).First(),
ClientId = g.Key,
Name = g.Select(x => x.Name).Where(x => x != null).First()
};
我遇到的问题是并非所有客户都在等待名单中,我想从索引中排除这些客户。我习惯了 SQL 思维,不知道在这里做什么来完成这个。
【问题讨论】:
标签: ravendb