3

我使用 RavenDb 作为我的门户。以下文件示例Question

{
  "CreatedOn": "2012-07-12T09:40:44.7514005Z",
  "CreatedBy": {
    "DisplayName": "Kamil",
  },
  "Subject": "My q",
  "Content": "My q content",
  "Tags": [
    "myQ"
  ],
  "Answers": {
    "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.Answer, QA.Core]], mscorlib",
    "$values": [
      {
        "CreatedOn": "2012-07-12T09:42:06.9852492Z",
        "CreatedBy": {
          "DisplayName": "Kamil",
        },
        "ModifiedOn": "2012-07-12T09:43:07.8442347Z",
        "ModifiedBy": {
          "DisplayName": "Kamil",
        },
        "Content": "My answer.",
        "IdNumber": 1,
        "Supporters": {
          "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
          "$values": []
        },
        "IsOfficial": true,
        "AttachmentHeaders": []
      }
    ]
  },
  "NumberOfViews": 3,
  "Supporters": {
    "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
    "$values": []
  },
  "NotificationEmails": [],
  "AttachmentHeaders": [],
  "LastAnswerId": 1
}

在 Question 类的大重构命名空间发生变化之后。在文档元数据(在 raven 中)中检测到更改并且没关系。但是嵌套集合怎么样:

  "Supporters": {
    "$type": "System.Collections.ObjectModel.Collection`1[[QA.Core.Entities.User, QA.Core]], mscorlib",
    "$values": []
  },

? 当我尝试从应用程序级别获取该文件时,该文件会产生错误。当我将其更改为:

  "Supporters": [],

但如果我必须对 200 个文档执行该操作,这不是解决方案。

有没有办法自动做到这一点?

4

1 回答 1

1

是的,请参阅:

http://ravendb.net/docs/client-api/set-based-operations

于 2012-07-13T07:54:22.867 回答