batch/db.archive/db.archive.batch.js
function getDocsToArchive(criteria, primaryCollection) {
        var deferred = Q.defer();

        primaryCollection.find(criteria).toArray(function (err, items) {
            err ? deferred.reject(err) : deferred.resolve(items);
        });

        return deferred.promise;
    }
function getDocsToArchive(criteria, primaryCollection) {
        var deferred = Q.defer();

        primaryCollection.find(criteria).toArray(function (err, items) {
            err ? deferred.reject(err) : deferred.resolve(items);
        });

        return deferred.promise;
    }
function getDocsToArchive ( criteria , primaryCollection ) { var deferred = Q . defer ( ) ; primaryCollection . find ( criteria ) . toArray ( function ( err , items ) { err ? deferred . reject ( err ) : deferred . resolve ( items ) ; } ) ; return deferred . promise ; }
Get the documents to archive
@param criteria
@param primaryCollection
Get the documents to archive