public function insert(array $document)
    {
        $result = $this->getMongoCollection()->insert($document);

        // if write concern acknowledged
        if (is_array($result)) {
            if ($result['ok'] != 1) {
                throw new Exception('Insert error: ' . $result['err'] . ': ' . $result['errmsg']);
            }

            return $this;
        }

        // if write concern unacknowledged
        if (!$result) {
            throw new Exception('Insert error');
        }

        return $this;
    }
public function insert(array $document)
    {
        $result = $this->getMongoCollection()->insert($document);

        // if write concern acknowledged
        if (is_array($result)) {
            if ($result['ok'] != 1) {
                throw new Exception('Insert error: ' . $result['err'] . ': ' . $result['errmsg']);
            }

            return $this;
        }

        // if write concern unacknowledged
        if (!$result) {
            throw new Exception('Insert error');
        }

        return $this;
    }
public function insert ( array $ document ) { $ result = $ this -> getMongoCollection ( ) -> insert ( $ document ) ; // if write concern acknowledged if ( is_array ( $ result ) ) { if ( $ result [ 'ok' ] != 1 ) { throw new Exception ( 'Insert error: ' . $ result [ 'err' ] . ': ' . $ result [ 'errmsg' ] ) ; } return $ this ; } // if write concern unacknowledged if ( ! $ result ) { throw new Exception ( 'Insert error' ) ; } return $ this ; }
Direct insert of array to MongoDB without creating document object and validation

@param array $document
@return \Sokil\Mongo\Collection
@throws Exception
Direct insert of array to MongoDB without creating document object and validation