如何将数据插入 meteorjs 中的远程 MongoDB?我怎么知道我是否连接到遥控器 MongoDB?
How do I insert data into remote MongoDB in meteorjs? How do I know if I'm connected to the remote MongoDB?
我是 MongoDB 和 MeteorJS 的新手。我正在尝试将我的流星应用程序连接到远程 mongodb。我在 ec2 上有一个 mongodb 设置。这是我的 mongod.conf:
dbpath=/var/lib/mongodb
port = 27000
#bind_ip = 127.0.0.1
auth=true
我试图将笔记本电脑上的流星应用程序连接到服务器。所以我这样做了:
#in meteor app folder
#in terminal
export MONGO_URL=mongodb://<admin>:<pwd>@<ec2-address>.compute.amazonaws.com:27000/meteor
在我的流星应用程序文件夹中,我有三个文件; connectmongo.html、connnectmongo.js 和 connectmongo.css
我的 connectmongo.js 看起来像这样:
Test = new Mongo.Collection('test');
然后,我 运行 终端中的 meteor 命令出现以下错误:
skaxwng@xps13:~/meteor/conmongo$ meteor
[[[[[ ~/meteor/conmongo ]]]]]
=> Started proxy.
W20150502-10:38:10.043(-5)? (STDERR)
W20150502-10:38:10.046(-5)? (STDERR) /home/skaxwng/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:278
W20150502-10:38:10.046(-5)? (STDERR) throw(ex);
W20150502-10:38:10.046(-5)? (STDERR) ^
W20150502-10:38:10.047(-5)? (STDERR) [object Object]
W20150502-10:38:10.047(-5)? (STDERR) at Object.Future.wait (/home/skaxwng/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
W20150502-10:38:10.047(-5)? (STDERR) at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
W20150502-10:38:10.047(-5)? (STDERR) at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
W20150502-10:38:10.047(-5)? (STDERR) at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
W20150502-10:38:10.047(-5)? (STDERR) at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
W20150502-10:38:10.048(-5)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:98:1)
W20150502-10:38:10.048(-5)? (STDERR) at app/conmongo.js:27:8
W20150502-10:38:10.048(-5)? (STDERR) at app/conmongo.js:29:3
W20150502-10:38:10.048(-5)? (STDERR) at /home/skaxwng/meteor/conmongo/.meteor/local/build/programs/server/boot.js:222:10
W20150502-10:38:10.048(-5)? (STDERR) at Array.forEach (native)
=> Exited with code: 8
我不知道我的应用程序是否连接到 mongo。我没有任何错误。
有人可以帮我解决这个问题吗?谢谢!
确保27000
端口在AWS安全规则中开放,然后可以使用mongo hostname:port/database -u username -p password
命令验证MONGO_URL
.
我是 MongoDB 和 MeteorJS 的新手。我正在尝试将我的流星应用程序连接到远程 mongodb。我在 ec2 上有一个 mongodb 设置。这是我的 mongod.conf:
dbpath=/var/lib/mongodb
port = 27000
#bind_ip = 127.0.0.1
auth=true
我试图将笔记本电脑上的流星应用程序连接到服务器。所以我这样做了:
#in meteor app folder
#in terminal
export MONGO_URL=mongodb://<admin>:<pwd>@<ec2-address>.compute.amazonaws.com:27000/meteor
在我的流星应用程序文件夹中,我有三个文件; connectmongo.html、connnectmongo.js 和 connectmongo.css
我的 connectmongo.js 看起来像这样:
Test = new Mongo.Collection('test');
然后,我 运行 终端中的 meteor 命令出现以下错误:
skaxwng@xps13:~/meteor/conmongo$ meteor
[[[[[ ~/meteor/conmongo ]]]]]
=> Started proxy.
W20150502-10:38:10.043(-5)? (STDERR)
W20150502-10:38:10.046(-5)? (STDERR) /home/skaxwng/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:278
W20150502-10:38:10.046(-5)? (STDERR) throw(ex);
W20150502-10:38:10.046(-5)? (STDERR) ^
W20150502-10:38:10.047(-5)? (STDERR) [object Object]
W20150502-10:38:10.047(-5)? (STDERR) at Object.Future.wait (/home/skaxwng/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
W20150502-10:38:10.047(-5)? (STDERR) at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
W20150502-10:38:10.047(-5)? (STDERR) at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
W20150502-10:38:10.047(-5)? (STDERR) at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
W20150502-10:38:10.047(-5)? (STDERR) at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
W20150502-10:38:10.048(-5)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:98:1)
W20150502-10:38:10.048(-5)? (STDERR) at app/conmongo.js:27:8
W20150502-10:38:10.048(-5)? (STDERR) at app/conmongo.js:29:3
W20150502-10:38:10.048(-5)? (STDERR) at /home/skaxwng/meteor/conmongo/.meteor/local/build/programs/server/boot.js:222:10
W20150502-10:38:10.048(-5)? (STDERR) at Array.forEach (native)
=> Exited with code: 8
我不知道我的应用程序是否连接到 mongo。我没有任何错误。
有人可以帮我解决这个问题吗?谢谢!
确保27000
端口在AWS安全规则中开放,然后可以使用mongo hostname:port/database -u username -p password
命令验证MONGO_URL
.