addToSet() {
    _checkManualPopulation(this, arguments);
    _depopulateIfNecessary(this, arguments);

    const values = [].map.call(arguments, this._mapCast, this);
    const added = [];
    let type = '';
    if (values[0] instanceof ArraySubdocument) {
      type = 'doc';
    } else if (values[0] instanceof Date) {
      type = 'date';
    } else if (isBsonType(values[0], 'ObjectId')) {
      type = 'ObjectId';
    }

    const rawValues = utils.isMongooseArray(values) ? values.__array : values;
    const rawArray = utils.isMongooseArray(this) ? this.__array : this;

    rawValues.forEach(function(v) {
      let found;
      const val = +v;
      switch (type) {
        case 'doc':
          found = this.some(function(doc) {
            return doc.equals(v);
          });
          break;
        case 'date':
          found = this.some(function(d) {
            return +d === val;
          });
          break;
        case 'ObjectId':
          found = this.find(o => o.toString() === v.toString());
          break;
        default:
          found = ~this.indexOf(v);
          break;
      }

      if (!found) {
        this._markModified();
        rawArray.push(v);
        this._registerAtomic('$addToSet', v);
        [].push.call(added, v);
      }
    }, this);

    return added;
  }
Adds values to the array if not already present.

#### Example:

    console.log(doc.array) // [2,3,4]
    const added = doc.array.addToSet(4,5);
    console.log(doc.array) // [2,3,4,5]
    console.log(added)     // [5]

@param {...any} [args]
@return {Array} the values that were added
@memberOf MongooseArray
@api public
@method addToSet