Macbook和MongoDB

时间:2017-06-13 16:57:43

标签: mongodb macos

我按照教程使用mongoDB作为应用程序,你有link。在安装mongodb时,我在9:50停留并且命令运行启动mongod是mongod --directoryperdb --dbpath c:\mongodb\data\db --logpath c:\mongodb\log\mongo.log --logappend -rest --install

在我的Mac上,我的桌面上有我的项目和mongo目录,所以我按照上面的视频安装了mongod。使用mongod --directoryperdb --dbpath /Usr/me/Desktop/mongodb/data/db --logpath /Usr/me/Desktop/mongodb/log/mongo.log --logappend -rest --install启动mongod指向不同的数据目录时遇到问题。

并且它不起作用(我还将bin文件复制到我的local/bin目录

以下是错误。

events.js:160
      throw er; // Unhandled 'error' event
      ^
MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (/Users/houssamtoulni/Desktop/proget/node_modules/mongodb-core/lib/topologies/server.js:328:35)
    at emitOne (events.js:96:13)
    at Pool.emit (events.js:188:7)
    at Connection.<anonymous> (/Users/houssamtoulni/Desktop/proget/node_modules/mongodb-core/lib/connection/pool.js:280:12)
    at Connection.g (events.js:292:16)
    at emitTwo (events.js:106:13)
    at Connection.emit (events.js:191:7)
    at Socket.<anonymous> (/Users/houssamtoulni/Desktop/proget/node_modules/mongodb-core/lib/connection/connection.js:177:49)
    at Socket.g (events.js:292:16)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1277:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

0 个答案:

没有答案