Description
openedon Aug 29, 2023
- Package Name: @azure/cosmos
- Package Version: 3.16.2
- Operating system: N/A
- nodejs
- version:
- browser
- name/version:
- typescript
- version:
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
When saving a Tables entity from Data Explorer without specifying a RowKew, SDK autogenerates a uuid and assigns it to "id" property. But it needs to set both "id" and "$id" with the RowKey value. The code in question can be found here: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/cosmosdb/cosmos/src/client/Item/Items.ts#L271
To Reproduce
Steps to reproduce the behavior:
- Log in to a Tables API account in Azure portal.
- Open Data Explorer.
- Create a table.
- Create an entity. Specify a partitionKey but NOT a rowKey.
- In another SDK attempt to fetch the created entity.
Expected behavior
The created entity should be fetched.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I believe Tables is somewhat unique in that it relies on the "$id" property to find documents as opposed to just the "id" field. Apparently Tables API fetches the entity fine when partitionKey is specified and rowKey is not. But I think, for completeness' sake, the uuid should be copied to "$id" at all times. You can confirm with Tables team.
For full context, see ICM https://portal.microsofticm.com/imp/v3/incidents/details/413947404/home.