I'm working with the Cosmos SDK in my my Node.js app. I've been able to query the database successfully but I'm having trouble with the REPLACE method. I'm wanting to update a single item in the database either by the unique 'id' field or the build in '_rid' field.
Here is the how I currently have it formatted (which returns the error: Entity with the specified id does not exist in the system):
const { resource: updatedItem } = await client.database(databaseId).container(contianerId).item('2INhAI1fcdkSAAAAERFAAA==', 'TX').replace(newJsonObject);
Sample Item:
'state' is the partition key
{
"DateTime": "01-28-19 11:55:48",
"id": "15",
"resolved": false,
"state": "TX",
"_rid": "2INhAI1fcdkSAAAAAAAAAA==",
"_self": "dbs/2INhAA==/colls/2INhAI1fcdk=/docs/2INhAI1fcdkSAAAAAAAAAA==/",
"_etag": "\"fd03208d-0000-0700-0000-5fc68a550000\"",
"_attachments": "attachments/",
"_ts": 1606847061
}
id, not_rid. What issue are you having, querying by id? Perhaps edit your question to show that query, and what error you receive?