public function add($key, $data)
    {
        $toInsert = $this->getDocumentData($data);

        $result = $this->collection->insertOne($toInsert);

        $data->_id = $result->getInsertedId();
    }
public function add($key, $data)
    {
        $toInsert = $this->getDocumentData($data);

        $result = $this->collection->insertOne($toInsert);

        $data->_id = $result->getInsertedId();
    }
public function add ( $ key , $ data ) { $ toInsert = $ this -> getDocumentData ( $ data ) ; $ result = $ this -> collection -> insertOne ( $ toInsert ) ; $ data -> _id = $ result -> getInsertedId ( ) ; }
adds an item to the registry


@param mixed $key
@param mixed $data

@throws \Exception
adds an item to the registry