remove()
Deletes the specified document from storage.
uniface.datastore.remove(
Doc)
uniface.datastore.remove(
_id:
String,
Rev)
Example: uniface.datastore.remove(doc._id, doc._rev);
Arguments
- Doc—document object to remove.
- DocId—identifier of the
document to delete, in the format
_id:
String (or Doc._id
) - Rev—revision of the document to delete, in the format
_rev:
String (or Doc._rev
)
Return Value
Returns a JavaScript Promise object with the response. For example:
{ "ok": true }
Otherwise, an error is returned. For more information, see Promises and Errors.
Using remove()
There are two ways to specify the document to be deleted from client-side storage:
- Specify the whole document:
uniface.datastore.get('songs_dsp').then(function(doc) { return uniface.datastore.remove(doc); }).then(function (result) { // handle result }).catch(function (err) { console.log(err); });
- Specify the document ID and revision:
uniface.datastore.get('songs_dsp').then(function(doc) { return uniface.datastore.remove(doc._id, doc._rev); }).then(function (result) { // handle result }).catch(function (err) { console.log(err); });