lib/storage/sync-updates.js
function doFindAndDeleteUpdate(datasetId, acknowledgement, callback) {
  debug('[%s] doFindAndDeleteUpdate acknowledgement = %j',datasetId,acknowledgement);
  var updatesCollection = mongoClient.collection(getDatasetUpdatesCollectionName(datasetId));
  updatesCollection.findOneAndDelete({cuid: acknowledgement.cuid, hash: acknowledgement.hash}, function(err, result) {
    if (err) {
      debugError('[%s] Failed to doFindAndDeleteUpdate due to error %s :: acknowledgement = %j',datasetId,err,acknowledgement);
      return callback(err);
    }
    return callback(null, result.value);
  });
}
function doFindAndDeleteUpdate(datasetId, acknowledgement, callback) {
  debug('[%s] doFindAndDeleteUpdate acknowledgement = %j',datasetId,acknowledgement);
  var updatesCollection = mongoClient.collection(getDatasetUpdatesCollectionName(datasetId));
  updatesCollection.findOneAndDelete({cuid: acknowledgement.cuid, hash: acknowledgement.hash}, function(err, result) {
    if (err) {
      debugError('[%s] Failed to doFindAndDeleteUpdate due to error %s :: acknowledgement = %j',datasetId,err,acknowledgement);
      return callback(err);
    }
    return callback(null, result.value);
  });
}
The acknowledgement object
@typedef {Object} storage~Acknowledgement
@property {String} type - if this updates has been applied successfully. Possible values: applied, failed and collisions.
@property {String} cuid - the unique client id that submitted that update
@property {String} action - the operation that the update is trying to perform. Possible values: create/update/delete
@property {String} hash - the hash value (can be considered as the unique id) of the update
@property {String} uid - the uid of the record the update is for
@property {String} msg - any message about the update. could be the error message if the update is failed
@property {Number} timestamp - when the update is applied
 
Find the delete the given sync update object from the `fhsync-<datasetId>-updates` collection
@param {String} datasetId
@param {storage~Acknowledgement} acknowledgement should at least have the `cuid` and `hash` fields
@param {Function} callback