【问题标题】:RavenDB cannot define the Map Reduce for my typesRavenDB 无法为我的类型定义 Map Reduce
【发布时间】:2015-10-24 13:42:06
【问题描述】:

我的 POCO 对象;

public class Chest
    {

       public Chest()
       {
           this.KeyIds = new List<string>();
           this.Keys = new List<Page>();
       }
       public string Id { get; set; }

       public string Name { get; set; }

        [JsonIgnore]
       public IList<Key> Keys { get; set; }

       public IList<string> KeyIds { get; set; }
    }

public class UserKey
{
   public string UserName { get; set; }

   public string Id { get; set; }

   public UserKey()
   {
       this.KeyIds = new List<string>();
   }

   public   IList<string> KeyIds { get; set; }
}

我想要我的用户键拥有的箱子。

例如:用户的 KeyIds=1,2,3

并且有这样的宝箱:

Chest1:名称:Hollywood,KeyIds=1

Chest2:Name:Mollywood, KeyIds=2

Chest3:Name:Barcelona,​​ KeyIds=1,2

Chest4:Name:Madrid, KeyIds=1,2,3

Chest5:Name:Dortmund, KeyIds=4

Chest6:Name:Milano, KeyIds=4,5

我将用户名作为参数提供给查询,结果应该返回给我

Chest1、Chest2、Chest3、Chest4 对象。

谢谢。问候

【问题讨论】:

    标签: c# join mapreduce ravendb


    【解决方案1】:

    加载用户实例,然后获取它拥有的密钥。 然后对键进行 In 查询。

    【讨论】:

    • 我想在 1 次查询中做到这一点,我会给用户键 ID 来查询胸部。
    • 您不能在单个查询中执行此操作,这需要在查询期间进行计算,这是不允许的。
    • 你能帮我写这个查询吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多