Skip to content

deleting a nonexistent record from datastore does not return an error #1397

Description

@lowagner

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

Activity

  1. 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
  2. stephenplusplus commented on Jun 29, 2016

    @stephenplusplus
    Contributor

    @pcostell should we return an error in this case? And if so, what logic should we use to determine an error?

  3. pcostell commented on Jun 29, 2016

    @pcostell
    Contributor

    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 of delete, the end result is the same regardless of if the entity existed or not (the entity will not exist).

  4. lowagner commented on Jun 29, 2016

    @lowagner
    Author

    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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions