Clear_table JavaScript function

The clear_table function is defined as:

clear_table: function(doc, parentfield) {
	for (var i=0, l=(doc[parentfield] || []).length; i<l; i++) {
		var d = doc[parentfield][i];
		delete locals[d.doctype][d.name];
	}
	doc[parentfield] = [];
}

Reading up on the delete operator, from my understanding this removes a property from an object. How does this relate to the database entry of that object? Does the entry remain intact? If so, what would be the best way to change this function to clear the database too?

database entries will be deleted on save document

1 Like