lib/data-store/index.js
function remove (dataStore, collectionName, resources, callback) {
  // Open the data store
  dataStore.__openDataStore(collectionName, (err, existingResources) => {
    if (err) {
      return callback(err);
    }

    // Remove the resources from the existing resources
    let removedResources = [];
    resources.forEach((resource) => {
      let removed = _.remove(existingResources, resource.filter(dataStore.__router));
      removedResources = removedResources.concat(removed);
    });

    if (removedResources.length > 0) {
      // Save the changes
      dataStore.__saveDataStore(collectionName, existingResources, (err) => {
        if (err) {
          callback(err);
        }
        else {
          callback(null, removedResources);
        }
      });
    }
    else {
      callback(null, []);
    }
  });
}
function remove (dataStore, collectionName, resources, callback) {
  // Open the data store
  dataStore.__openDataStore(collectionName, (err, existingResources) => {
    if (err) {
      return callback(err);
    }

    // Remove the resources from the existing resources
    let removedResources = [];
    resources.forEach((resource) => {
      let removed = _.remove(existingResources, resource.filter(dataStore.__router));
      removedResources = removedResources.concat(removed);
    });

    if (removedResources.length > 0) {
      // Save the changes
      dataStore.__saveDataStore(collectionName, existingResources, (err) => {
        if (err) {
          callback(err);
        }
        else {
          callback(null, removedResources);
        }
      });
    }
    else {
      callback(null, []);
    }
  });
}
function remove ( dataStore , collectionName , resources , callback ) { // Open the data store dataStore . __openDataStore ( collectionName , ( err , existingResources ) => { if ( err ) { return callback ( err ) ; } // Remove the resources from the existing resources let removedResources = [ ] ; resources . forEach ( ( resource ) => { let removed = _ . remove ( existingResources , resource . filter ( dataStore . __router ) ) ; removedResources = removedResources . concat ( removed ) ; } ) ; if ( removedResources . length > 0 ) { // Save the changes dataStore . __saveDataStore ( collectionName , existingResources , ( err ) => { if ( err ) { callback ( err ) ; } else { callback ( null , removedResources ) ; } } ) ; } else { callback ( null , [ ] ) ; } } ) ; }
Removes the given resource from the data store.

@param   {DataStore}     dataStore      - The DataStore to operate on
@param   {string}        collectionName - The collection that all the resources belong to
@param   {Resource[]}    resources      - The Resources to be removed
@param   {function}      callback       - Callback function
Removes the given resource from the data store .