public function post() { $id_key = $this->model->getId(); $id_schema = $this->model->getSchema($id_key); if ($id_schema['type'] == 'id' || $id_schema['type'] == 'string') { $id = new \MongoId(); } else { throw new \Exception('Cannot autogenerate id'); } return $this->put($id); }