set(i, val, skipModified) {
    const arr = this.__array;
    if (skipModified) {
      arr[i] = val;
      return this;
    }
    const value = methods._cast.call(this, val, i);
    methods._markModified.call(this, i);
    arr[i] = value;
    return this;
  }
Sets the casted `val` at index `i` and marks the array modified.

#### Example:

    // given documents based on the following
    const Doc = mongoose.model('Doc', new Schema({ array: [Number] }));

    const doc = new Doc({ array: [2,3,4] })

    console.log(doc.array) // [2,3,4]

    doc.array.set(1,"5");
    console.log(doc.array); // [2,5,4] // properly cast to number
    doc.save() // the change is saved

    // VS not using array#set
    doc.array[1] = "5";
    console.log(doc.array); // [2,"5",4] // no casting
    doc.save() // change is not saved

@return {Array} this
@api public
@method set
@memberOf MongooseArray