Skip to content

Commit

Permalink
CosmosDB - improvement of the filter for cross partition
Browse files Browse the repository at this point in the history
Signed-off-by: Luigi Rende <luigirende@gmail.com>
  • Loading branch information
luigirende committed Dec 7, 2023
1 parent 921c364 commit 2a7ff4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions state/azure/cosmosdb/cosmosdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ func (p crossPartitionQueryPolicy) Do(req *policy.Request) (*http.Response, erro
// Check if we're performing a query
// In that case, remove the partitionkey header and enable cross-partition queries
if strings.ToLower(raw.Header.Get("x-ms-documentdb-query")) == "true" {
raw.Header.Add("x-ms-documentdb-query-enablecrosspartition", "True")
// Only when the partitionKey is fake (true), it will be removed
// Only when the partitionKey is fake (true), it will be removed amd enabled the cross partition
if strings.ToLower(raw.Header.Get("x-ms-documentdb-partitionkey")) == "[true]" {
raw.Header.Add("x-ms-documentdb-query-enablecrosspartition", "true")
raw.Header.Del("x-ms-documentdb-partitionkey")
}
}
Expand Down

0 comments on commit 2a7ff4d

Please sign in to comment.