且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Azure DocumentDB REST API获得100多个查询结果

更新时间:2023-02-15 09:33:15

对于SQL查询,如果结果集太大,则按段返回结果.默认情况下,结果以100个项目或1 MB(以先达到限制为准)的块形式返回.

For a SQL query the results are returned in segments if the result set is too large. The results are returned in chunks of 100 items or 1 MB (whichever limit is hit first) by default.

您可以使用延续标记来获取每个片段.或者,您可以在请求中设置 x-ms-max-item-count 自定义标头,以将限制增加到适当的值.

You can either use continuation tokens to get each segment after another. Or you set the x-ms-max-item-count custom header in a request to increase the limit to an appropriate value.

您可以查看 REST API 了解更多详细信息.

You can have a look the the REST API for further details.

对于示例程序,您必须添加行

For the sample program you have to add the line

client.DefaultRequestHeaders.Add("x-ms-max-item-count", "1000");

以获取1000个文档而不是100个文档.

in order to get 1000 documents instead of 100.