Execution of Stored Procedure seems to ignore passed in Partition Key Value

Mike Lee 81 Reputation points

I've been getting up to speed with Store Procedures with Cosmos DB and I've found that when I execute a sp i wrote the returned docs ignore the partition key value I pass in.

For example, a couple of docs that look something like this (partition key is /city):

"projectId": 100,
"projectName": "civil bridge 1",
"city": "chicago"

"projectId": 101,
"projectName": "civil bridge 2",
"city": "chicago"

"projectId": 103,
"projectName": "civil bridge 3",
"city": "seattle"

The stored procedure is passed in a project name search term as a parameter. So if the term passed in is "bridge" the documents that have the term "bridge" should be returned.

When I execute the stored procedure using "bridge" as the search term and a partition value of "chicago" I would expect to see the first 2 docs returned. However, during my testing I'm seeing all 3 docs returned.

Does anyone know why I'm seeing results from outside the partition I specified when I called the stored procedure?



Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,050 questions
{count} votes

Accepted answer
  1. Mark Brown - MSFT 2,751 Reputation points Microsoft Employee

    This is a known issue where JS query api doesn’t treat PK value while queryDocuments implicitly adds to the query.

    If you add the PK condition manually to the __.filter it will work.


0 additional answers

Sort by: Most helpful