Add support for multi-partition key (#1252)

This commit is contained in:
victor-meng
2022-04-21 13:37:02 -07:00
committed by GitHub
parent 9e7bbcfab6
commit 22f7d588a1
21 changed files with 175 additions and 158 deletions

View File

@@ -3,15 +3,16 @@ import * as ViewModels from "../Contracts/ViewModels";
export function buildDocumentsQuery(
filter: string,
partitionKeyProperty: string,
partitionKeyProperties: string[],
partitionKey: DataModels.PartitionKey
): string {
let query = partitionKeyProperty
? `select c.id, c._self, c._rid, c._ts, ${buildDocumentsQueryPartitionProjections(
"c",
partitionKey
)} as _partitionKeyValue from c`
: `select c.id, c._self, c._rid, c._ts from c`;
let query =
partitionKeyProperties && partitionKeyProperties.length > 0
? `select c.id, c._self, c._rid, c._ts, [${buildDocumentsQueryPartitionProjections(
"c",
partitionKey
)}] as _partitionKeyValue from c`
: `select c.id, c._self, c._rid, c._ts from c`;
if (filter) {
query += " " + filter;