Repository navigation
deleting a nonexistent record from datastore does not return an error #1397
Description
Activity
- changed the title
[-]deleting a nonexistent file from datastore does not return an error[/-][+]deleting a nonexistent record from datastore does not return an error[/+]on Jun 29, 2016 @pcostell should we return an error in this case? And if so, what logic should we use to determine an error?
- addedapi: datastoreIssues related to the Datastore API.Issues related to the Datastore API.
on Jun 29, 2016 This is expected. In particular, the Datastore API documentation states:
// The key of the entity to delete. The entity may or may not already exist. // Must have a complete key path and must not be reserved/read-only. Key delete = 7;Doing this in the client would require doing a transaction first with a
Lookup. I'm not sure it makes sense to provide this functionality, as it would require doing multiple round trips to delete. In the case ofdelete, the end result is the same regardless of if the entity existed or not (the entity will not exist).i guess the idea is if you chain deletes; if you delete something, then you always delete something else (which is related to the first). in the event that someone goes to the "delete" page again, the first delete will go through without issue, and the second delete may fail for weird reasons... i was just getting the whole nodejs server to crash. at any rate, that's probably a bug on my part, so i'll go look for a fix there.
anyhoo, it's something i can check, through the full response, checking if fullResponse.indexUpdates === 0, right?
[edit]
it seems to be the opposite behavior of the cloud storage, however. i had trouble deleting cloud storage files which should have existed but didn't, and the bucket.file().delete() commands were hanging. i suppose that is another issue though, which i should put up if i can replicate it for some sane programming...- added a commit that references this issue
on Mar 5, 2026 - added a commit that references this issue
on Mar 27, 2026
it would be nice if it did, then we wouldn't have to run a check on the full API response in addition to the error message, before proceeding safely...
only checked on version 0.36