An exception occurs when performing aggregated queries on the x64 platform

When executing a query using aggregates, I get the following exception:

Microsoft.Azure.Documents.BadRequestException: 
{"Errors":["Cross partition query only supports 'VALUE <AggreateFunc>' for aggregates."]} 
---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A0B00

My request code:

var store = "1234";
var sumResults = client.CreateDocumentQuery(
UriFactory.CreateDocumentCollectionUri("my-data-db", "my-collection"),
$"SELECT SUM(t.totalAmount) FROM t where t.siteData.siteID = '{store}'");

It took me a while to figure out that this works great when the build platform is installed on x86, but the installation fails on x64.

I am using the latest version of package 1.12.2

Any ideas on how to make the x64 version work?

+4
source share
2 answers

Microsoft.Azure.DocumentDB 1.12.2, DocomentDB Emulator, Azure DocumentDB, , , SQL (, COUNT, MIN, MAX, SUM AVG) DocomentDB Emulator ( - 1.11.136.2), x64.

document Azure DocumentDB:

DocumentDB. DocumentDB DocumentDB SDK, REST API Azure Portal. SDK, LINQ .NET.

, LINQ :

var amount=client.CreateDocumentQuery<DocEntity>("/dbs/{your-db-id}/colls/{your-collection-id}",
     new FeedOptions { MaxDegreeOfParallelism = -1 })
      .Where(r => r.siteID == "1234")
      .Sum(r=>r.totalAmount);

, :

{"query":"SELECT VALUE Sum(root[\"totalAmount\"]) FROM root WHERE (root[\"siteID\"] =\"1234\") "}

.

+3

,

(1) FROM C

+2

Source: https://habr.com/ru/post/1672735/


All Articles