首页 文章

DocumentDb Id字段

提问于
浏览
0

DocumentDb Id字段是否有数据类型或长度限制?

我一直在DocumentDb数据库的ID字段中使用GUID值,一切都运行正常 .

我现在需要在ID字段中进行更改并为ID添加前缀 . 这还没有在 生产环境 上运行 . 我只是使用DocumentDb模拟器在本地测试它 .

只是举个例子,我的Id曾经是这样的典型GUID: 5e035f00-e1e3-430d-ae45-85f2815731f7 . 现在,它将是这样的: 20-5e035f00-e1e3-430d-ae45-85f2815731f7 . 基本上,我现在是'm adding a 2-4 digit prefix followed by a hyphen to the beginning of Id' .

看起来我能够很好地创建文档但是在查询它们时,我的代码中出现了错误 . 我没有对运行针对数据库的查询的代码进行任何更改 .

这是一直运行的查询代码:

public async static Task<IEnumerable<T>> QueryAsync<T>(this IQueryable<T> query)
   {
      var docQuery = query.AsDocumentQuery();
      var batches = new List<IEnumerable<T>>();

      do
      {
         var batch = await docQuery.ExecuteNextAsync<T>(); // My code is blowing up here
         batches.Add(batch);
      }
      while (docQuery.HasMoreResults);

      var docs = batches.SelectMany(b => b);

      return docs;
}

1 回答

  • 1

    实际目的没有限制 . 你可以为你的“爆炸”地方发布callstack吗?

相关问题