$shift() {
    this._registerAtomic('$pop', -1);
    this._markModified();

    // only allow shifting once
    const __array = this.__array;
    if (__array._shifted) {
      return;
    }
    __array._shifted = true;

    return [].shift.call(__array);
  }
Atomically shifts the array at most one time per document `save()`.

#### Note:

_Calling this multiple times on an array before saving sends the same command as calling it once._
_This update is implemented using the MongoDB [$pop](https://www.mongodb.com/docs/manual/reference/operator/update/pop/) method which enforces this restriction._

     doc.array = [1,2,3];

     const shifted = doc.array.$shift();
     console.log(shifted); // 1
     console.log(doc.array); // [2,3]

     // no affect
     shifted = doc.array.$shift();
     console.log(doc.array); // [2,3]

     doc.save(function (err) {
       if (err) return handleError(err);

       // we saved, now $shift works again
       shifted = doc.array.$shift();
       console.log(shifted ); // 2
       console.log(doc.array); // [3]
     })

@api public
@memberOf MongooseArray
@instance
@method $shift
@see mongodb https://www.mongodb.com/docs/manual/reference/operator/update/pop/