index.js
function(req, data, name, snippet, field, callback) {
      var manager = self._pages.getManager(field.withType);
      if (!manager) {
        return callback(new Error('join with type ' + field.withType + ' unrecognized'));
      }
      var titlesOrIds = self._apos.sanitizeString(data[name]).split(/\s*,\s*/);
      if ((!titlesOrIds) || (titlesOrIds[0] === undefined)) {
        return setImmediate(callback);
      }
      var clauses = [];
      _.each(titlesOrIds, function(titleOrId) {
        clauses.push({ sortTitle: self._apos.sortify(titleOrId) });
        clauses.push({ _id: titleOrId });
      });
      return manager.get(req, { $or: clauses }, { fields: { _id: 1 }, withJoins: false }, function(err, results) {
        if (err) {
          return callback(err);
        }
        results = results.pages || results.snippets;
        if (field.limit !== undefined) {
          results = results.slice(0, field.limit);
        }
        snippet[field.idsField] = _.pluck(results, '_id');
        return callback(null);
      });
    }
function(req, data, name, snippet, field, callback) {
      var manager = self._pages.getManager(field.withType);
      if (!manager) {
        return callback(new Error('join with type ' + field.withType + ' unrecognized'));
      }
      var titlesOrIds = self._apos.sanitizeString(data[name]).split(/\s*,\s*/);
      if ((!titlesOrIds) || (titlesOrIds[0] === undefined)) {
        return setImmediate(callback);
      }
      var clauses = [];
      _.each(titlesOrIds, function(titleOrId) {
        clauses.push({ sortTitle: self._apos.sortify(titleOrId) });
        clauses.push({ _id: titleOrId });
      });
      return manager.get(req, { $or: clauses }, { fields: { _id: 1 }, withJoins: false }, function(err, results) {
        if (err) {
          return callback(err);
        }
        results = results.pages || results.snippets;
        if (field.limit !== undefined) {
          results = results.slice(0, field.limit);
        }
        snippet[field.idsField] = _.pluck(results, '_id');
        return callback(null);
      });
    }
function ( req , data , name , snippet , field , callback ) { var manager = self . _pages . getManager ( field . withType ) ; if ( ! manager ) { return callback ( new Error ( 'join with type ' + field . withType + ' unrecognized' ) ) ; } var titlesOrIds = self . _apos . sanitizeString ( data [ name ] ) . split ( / \s*,\s* / ) ; if ( ( ! titlesOrIds ) || ( titlesOrIds [ 0 ] === undefined ) ) { return setImmediate ( callback ) ; } var clauses = [ ] ; _ . each ( titlesOrIds , function ( titleOrId ) { clauses . push ( { sortTitle : self . _apos . sortify ( titleOrId ) } ) ; clauses . push ( { _id : titleOrId } ) ; } ) ; return manager . get ( req , { $or : clauses } , { fields : { _id : 1 } , withJoins : false } , function ( err , results ) { if ( err ) { return callback ( err ) ; } results = results . pages || results . snippets ; if ( field . limit !== undefined ) { results = results . slice ( 0 , field . limit ) ; } snippet [ field . idsField ] = _ . pluck ( results , '_id' ) ; return callback ( null ) ; } ) ; }
Support for array joins in CSV imports, by title or id of items joined with, in a comma-separated list. Title match is tolerant, but you must NOT supply any commas that may appear in the titles of the individual items, since commas are reserved for separating items in the list
Support for array joins in CSV imports by title or id of items joined with in a comma - separated list . Title match is tolerant but you must NOT supply any commas that may appear in the titles of the individual items since commas are reserved for separating items in the list