RavenDB索引创建

时间:2012-01-21 16:32:23

标签: ravendb

我正在努力学习编写索引。例如,我在管理工具中执行了以下操作,它可以正常工作:

from doc in docs.RavenJObjects
from table in doc["Loader"]["Table"] where table["@Type"] == "Contact_Info"
from row in (IEnumerable<dynamic>)table["Row"] where Convert.ToInt32(row["@Index"]) > 1
select new {}

我使用代码尝试了相同的语法,但是我收到了错误:

DocStore.DatabaseCommands.PutIndex("JIndex", new Raven.Client.Indexes.IndexDefinitionBuilder<RavenJObject>
{
    Map = docs => from doc in docs
              from table in doc["Loader"]["Table"] where table["@Type"] == "Contact_Info"
              from row in (IEnumerable<dynamic>)table["Row"] where Convert.ToInt32(row["@Index"]) > 1
              select new {}

});

错误:

Cannot apply indexing with [] to an expression of type 'Raven.Json.Linq.RavenJToken'

代码中的正确语法应该是什么?感谢

0 个答案:

没有答案