Created a Collection in Cosmos DB with Email as partition key and added around ten documents to that collection.
When I query the collection with Partition Key
in RequestOptions
, returns all the documents which has the supplied partition key.
var result = await documentRUClient.ExecuteStoredProcedureAsync<string>
(UriFactory.CreateStoredProcedureUri(DataBaseId, CollectionId,
"GetCollection"), new RequestOptions { PartitionKey =
new PartitionKey("test @test.com") });
Stored Procedure:
function GetCollection() {
var context = getContext();
var collectionManager = context.getCollection();
var collectionLink = collectionManager.getSelfLink();
var query = "SELECT * FROM c";
collectionManager.queryDocuments(collectionLink, query, function(err, documents){
context.getResponse().setBody(documents);
});
}
Now I need to get all the documents from all partition in that collection. I have tried the below code, but it gives the error PartitionKey value must be supplied for this operation.
var result = await documentRUClient.ExecuteStoredProcedureAsync<string>
(UriFactory.CreateStoredProcedureUri(DataBaseId, CollectionId,
"GetCollection"));
Please suggest a way to achieve this.