public function createReference()
{
if (!$this->isRootDocument()) {
require_once 'Shanty/Mongo/Exception.php';
throw new Shanty_Mongo_Exception('Can not create reference. Document is not a root document');
}
if (!$this->isConnected()) {
require_once 'Shanty/Mongo/Exception.php';
throw new Shanty_Mongo_Exception('Can not create reference. Document does not connected to a db and collection');
}
return MongoDBRef::create($this->getConfigAttribute('collection'), $this->getId());
}