当我尝试启动时,出现以下错误

时间:2019-03-06 10:33:08

标签: mongodb windows-7

当我尝试启动时,出现以下错误

  

@(连接):1:6   例外:连接失败

     

C:\ MongoDB \ Server \ 4.0 \ bin> mongodb   无法将“ mongodb”识别为内部或外部命令,   可操作的程序或批处理文件。

     

C:\ MongoDB \ Server \ 4.0 \ bin> mongo启动   MongoDB Shell版本v4.0.6   连接到:mongodb://127.0.0.1:27017 / start?gssapiServiceName = mongodb   2019-03-06T15:44:04.853 + 0530 E查询[js]错误:无法连接到服务器1   27.0.0.1:27017,连接尝试失败:SocketException:连接到时出错   127.0.0.1:27017 ::由::引起:无法建立连接,因为目标m   achine积极拒绝。 :   connect@src/mongo/shell/mongo.js:343:13   @(连接):1:6   例外:连接失败

1 个答案:

答案 0 :(得分:0)

您使用{ "name": "test_app", "version": "1.0.0", "description": "TEST APP", "author": "STB Tech Dev", "private": true, "scripts": { "dev": "nuxt", "build": "nuxt build --spa", "start": "nuxt start", "generate": "nuxt generate", "test": "mocha --recursive -r esm" }, "dependencies": { "@johmun/vue-tags-input": "^2.0.1", "axios": "^0.18.0", "bootstrap-vue": "^2.0.0-rc.11", "chai": "^4.2.0", "config": "^3.0.1", "cookieparser": "^0.1.0", "cross-env": "^5.2.0", "esm": "^3.2.5", "faker": "^4.1.0", "jquery": "^3.3.1", "js-cookie": "^2.2.0", "mocha": "^6.0.1", "nuxt": "^2.4.3", "repl": "^0.1.3", "sinon": "^7.2.4", "vue-bootstrap-toggle": "^1.1.4", "vue-clamp": "^0.2.1", "vue-date-pick": "^1.1.0", "vue-loader": "^15.6.4", "vue-select": "^2.5.1", "vuedraggable": "^2.17.0", "vuejs-noty": "^0.1.3", "vuelidate": "^0.7.4" }, "devDependencies": { "dotenv": "^6.2.0", "node-sass": "^4.10.0", "nodemon": "^1.18.10", "nyc": "^13.3.0", "sass-loader": "^7.1.0" } } 作为启动MongoDB的命令,但它应该是mongodb

要启动MongoDB Server,请运行mongod.exe。使用以下命令,

mongod

然后,您可以使用命令mongod --dbpath="<DATABASE DIRECTORY>"

与MongoDB连接

Windows上的默认路径MongoDB,位于mongo