Deleting Database Data

You delete data from a database table by calling the del() method. Here is how you would delete a task from the Tasks table:

var taskToDelete = {    id: 3,    name: "Finish writing chapter 10"};tasksTable.del(taskToDelete).done(    // Success    function () {},    // Fail    function (err) {})

You must pass the value of the primary key of the object being deleted to the del() method. In the preceding code, the taskToDelete has both an id and name property and the task with an id of 3 is deleted. (This code would work fine even if I left out the name property.)

You don’t get anything back when a record is deleted successfully. Therefore, there is no reason to include a parameter for the success ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.