pull() {
    const values = [].map.call(arguments, (v, i) => this._cast(v, i, { defaults: false }), this);
    let cur = this[arrayParentSymbol].get(this[arrayPathSymbol]);
    if (utils.isMongooseArray(cur)) {
      cur = cur.__array;
    }
    let i = cur.length;
    let mem;
    this._markModified();

    while (i--) {
      mem = cur[i];
      if (mem instanceof Document) {
        const some = values.some(function(v) {
          return mem.equals(v);
        });
        if (some) {
          cur.splice(i, 1);
        }
      } else if (~this.indexOf.call(values, mem)) {
        cur.splice(i, 1);
      }
    }

    if (values[0] instanceof ArraySubdocument) {
      this._registerAtomic('$pullDocs', values.map(function(v) {
        const _id = v.$__getValue('_id');
        if (_id === undefined || v.$isDefault('_id')) {
          return v;
        }
        return _id;
      }));
    } else {
      this._registerAtomic('$pullAll', values);
    }


    // Might have modified child paths and then pulled, like
    // `doc.children[1].name = 'test';` followed by
    // `doc.children.remove(doc.children[0]);`. In this case we fall back
    // to a `$set` on the whole array. See #3511
    if (cleanModifiedSubpaths(this[arrayParentSymbol], this[arrayPathSymbol]) > 0) {
      this._registerAtomic('$set', this);
    }

    return this;
  }
Pulls items from the array atomically. Equality is determined by casting
the provided value to an embedded document and comparing using
[the `Document.equals()` function.](https://mongoosejs.com/docs/api/document.html#Document.prototype.equals())

#### Example:

    doc.array.pull(ObjectId)
    doc.array.pull({ _id: 'someId' })
    doc.array.pull(36)
    doc.array.pull('tag 1', 'tag 2')

To remove a document from a subdocument array we may pass an object with a matching `_id`.

    doc.subdocs.push({ _id: 4815162342 })
    doc.subdocs.pull({ _id: 4815162342 }) // removed

Or we may passing the _id directly and let mongoose take care of it.

    doc.subdocs.push({ _id: 4815162342 })
    doc.subdocs.pull(4815162342); // works

The first pull call will result in a atomic operation on the database, if pull is called repeatedly without saving the document, a $set operation is used on the complete array instead, overwriting possible changes that happened on the database in the meantime.

@param {...any} [args]
@see mongodb https://www.mongodb.com/docs/manual/reference/operator/update/pull/
@api public
@method pull
@memberOf MongooseArray