DB\Mongo\Mapper::insert PHP Метод

insert() публичный Метод

Insert new record
public insert ( ) : array
Результат array
    function insert()
    {
        if (isset($this->document['_id'])) {
            return $this->update();
        }
        if (isset($this->trigger['beforeinsert']) && \Base::instance()->call($this->trigger['beforeinsert'], [$this, ['_id' => $this->document['_id']]]) === FALSE) {
            return $this->document;
        }
        $this->collection->insert($this->document);
        $pkey = ['_id' => $this->document['_id']];
        if (isset($this->trigger['afterinsert'])) {
            \Base::instance()->call($this->trigger['afterinsert'], [$this, $pkey]);
        }
        $this->load($pkey);
        return $this->document;
    }