From 56731ec0518366c64e40f22262abaf2fe734d44b Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Wed, 27 Apr 2022 11:12:57 -0700 Subject: [PATCH] Fix error when reading document with no partition key (#1256) --- src/Common/dataAccess/readDocument.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Common/dataAccess/readDocument.ts b/src/Common/dataAccess/readDocument.ts index fce09cceb..6e826b041 100644 --- a/src/Common/dataAccess/readDocument.ts +++ b/src/Common/dataAccess/readDocument.ts @@ -21,7 +21,8 @@ export const readDocument = async (collection: CollectionBase, documentId: Docum const response = await client() .database(collection.databaseId) .container(collection.id()) - .item(documentId.id(), documentId.partitionKeyValue) + // use undefined if the partitionKeyValue is empty + .item(documentId.id(), documentId.partitionKeyValue?.length === 0 ? undefined : documentId.partitionKeyValue) .read(options); return response?.resource;