Deleting a model

To delete a model from the datastore, call Datastore.delete() method with the key:
Key key = ...;
Datastore.delete(key);

To delete multiple models, call the Datastore.delete() method with a Collection or an array of keys. This method is more efficient than a series of individual Datastore.delete() invocations.
List<Key> keys = ...;
Datastore.delete(keys);

Datastore.delete(key, key2, key3);

To delete all descendant models(include ancestor), call the Datastore.deleteAll() method with an ancestor key.
Datastore.deleteAll(ancestorKey);


You can delete a model asynchronously as follows:
Key key = ...;
Future<Void> future = Datastore.deleteAsync(key);
// Do something
...
// Get the result
future.get();

Next...

Continue to Queries and Indexes.


Comments