我是 Mongodb 和 Doctrine 的新手。当我将数据传递给 Mongo 数据库时,我遇到了以下错误。
Failed to connect to: localhost:27017: Transport endpoint is not connected
堆栈跟踪:
0 /home/anu/zf2-tutorial/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Connection.php(102): MongoClient->__construct('mongodb://root:...', Array)
#1 /home/anu/zf2-tutorial/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Connection.php(283): Doctrine\MongoDB\Connection->Doctrine\MongoDB\{closure}()
#2 /home/anu/zf2-tutorial/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Connection.php(103): Doctrine\MongoDB\Connection->retry(Object(Closure))
#3 /home/anu/zf2-tutorial/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Connection.php(251): Doctrine\MongoDB\Connection->initialize()
#4 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php(310): Doctrine\MongoDB\Connection->selectDatabase('zf2tutorial')
#5 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php(339): Doctrine\ODM\MongoDB\DocumentManager->getDocumentDatabase('Lesson\Document...')
#6 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php(148): Doctrine\ODM\MongoDB\DocumentManager->getDocumentCollection('Lesson\Document...')
#7 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(334): Doctrine\ODM\MongoDB\Persisters\DocumentPersister->__construct(Object(Doctrine\ODM\MongoDB\Persisters\PersistenceBuilder), Object(Doctrine\ODM\MongoDB\DocumentManager), Object(Doctrine\Common\EventManager), Object(Doctrine\ODM\MongoDB\UnitOfWork), Object(Doctrine\ODM\MongoDB\Hydrator\HydratorFactory), Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), '$')
#8 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(968): Doctrine\ODM\MongoDB\UnitOfWork->getDocumentPersister('Lesson\Document...')
#9 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php(432): Doctrine\ODM\MongoDB\UnitOfWork->executeInserts(Object(Doctrine\ODM\MongoDB\Mapping\ClassMetadata), Array)
#10 /home/anu/zf2-tutorial/vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php(531): Doctrine\ODM\MongoDB\UnitOfWork->commit(NULL, Array)
#11 /home/anu/zf2-tutorial/module/Lesson/src/Lesson/Controller/LessonController.php(48): Doctrine\ODM\MongoDB\DocumentManager->flush()
#12 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83): Lesson\Controller\LessonController->addAction()
#13 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#14 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(460): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#15 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(204): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#16 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#18 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#19 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(460): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#20 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(204): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#21 /home/anu/zf2-tutorial/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(294): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#22 /home/anu/zf2-tutorial/public/index.php(12): Zend\Mvc\Application->run()
#23 {main}
有任何想法吗??如果有人能找出问题并让我知道,我将不胜感激。
提前致谢。