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 titleOrId = self._apos.sanitizeString(data[name]);
      var criteria = { $or: [ { sortTitle: self._apos.sortify(titleOrId) }, { _id: titleOrId } ] };
      return manager.get(req, criteria, { fields: { _id: 1 } }, function(err, results) {
        if (err) {
          return callback(err);
        }
        results = results.pages || results.snippets;
        if (!results.length) {
          return callback(null);
        }
        snippet[field.idField] = results[0]._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 titleOrId = self._apos.sanitizeString(data[name]);
      var criteria = { $or: [ { sortTitle: self._apos.sortify(titleOrId) }, { _id: titleOrId } ] };
      return manager.get(req, criteria, { fields: { _id: 1 } }, function(err, results) {
        if (err) {
          return callback(err);
        }
        results = results.pages || results.snippets;
        if (!results.length) {
          return callback(null);
        }
        snippet[field.idField] = results[0]._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 titleOrId = self . _apos . sanitizeString ( data [ name ] ) ; var criteria = { $or : [ { sortTitle : self . _apos . sortify ( titleOrId ) } , { _id : titleOrId } ] } ; return manager . get ( req , criteria , { fields : { _id : 1 } } , function ( err , results ) { if ( err ) { return callback ( err ) ; } results = results . pages || results . snippets ; if ( ! results . length ) { return callback ( null ) ; } snippet [ field . idField ] = results [ 0 ] . _id ; return callback ( null ) ; } ) ; }
Support for one-to-one joins in CSV imports, by title or id of item joined with. Title match is tolerant
Support for one - to - one joins in CSV imports by title or id of item joined with . Title match is tolerant