0
votes

Simple question :

if I add documents with push:false to a collection linked to an adapter and then delete them, will they be marked dirty for deleting?

1

1 Answers

3
votes

You can use the getAllDirty (Worklight Version == v6.2) or getPushRequired (Worklight Version < v6.2) APIs after the operations (add, remove) to see their state. If the change is not tracked (add w/o tracking the change, remove) you will not get a document back. In that case the intent is that instead of telling the backed "add this document, then remove it" the API just doesn't tell the server about the document. It's a bit more efficient than sending a change over the network that will just get removed.

Otherwise, if the change is tracked as it's the case for add(doc) you will get back something like this as one of the elements of the array returned:

{_id: 1,
  json: {id: 1, ssn: '111-22-3333', name: 'Carlos'},
  _operation: 'add',
  _dirty: '1395774961,12902'}

Where _operation is the last operation performed. When using push (deprecated in Worklight v6.2) it will send that document to the adapter procedure noted in the _operation field (e.g. add => add procedure). The documentation here covers how to work with external data in Worklight v6.2. The API documentation is here and here. There are also examples of the various APIs here. Feature requests here.