DELETE

This method allows you to delete an entity in the Datastore. It accepts the following arguments:

MyModel.delete(
    /* {int|string}. -- Can also be an Array of ids to delete */
    <id>,
    /* {Array} -- optional. ex: ['ParentEntity', 1234 ] */
    <ancestors>,
    /* {string} -- optional. A specific namespace */
    <namespace>,
    /* {Transaction} -- optional. The transaction currently in progress */
    <transaction>,
    /*
        {object|Array} -- optional. An entityKey. Can also be an *Array* of keys.
        If you already know the key (after a get() for ex.) you can pass it here.
    */
    <key>
)

@returns -- an object with the following properties

  • success -- a boolean set to true if one or serveral entity(ies) has/have been deleted or false if not.

  • key -- the entity key(s) that have been deleted

  • apiResponse -- the api response from @google-cloud-node

Examples:

Last updated

Was this helpful?