Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js AWS上的Mongodb问题_Node.js_Mongodb_Amazon Web Services - Fatal编程技术网

Node.js AWS上的Mongodb问题

Node.js AWS上的Mongodb问题,node.js,mongodb,amazon-web-services,Node.js,Mongodb,Amazon Web Services,我一直在尝试在我的AWS EC2实例上安装Mongodb,以便与我编写的Node.js服务器配合使用 根据指南,我能够“安装”monogdb 但是,我将mongod和mongo的路径设置为别名,因为在我注销时这些路径被删除 alias mongod='/home/ec2-user/mongodb/mongodb-linux-x86_64-3.0.0/bin/mongod' alias mongo='/home/ec2-user/mongodb/mongodb-linux-x86_64-3.0.0

我一直在尝试在我的AWS EC2实例上安装Mongodb,以便与我编写的Node.js服务器配合使用

根据指南,我能够“安装”monogdb

但是,我将mongod和mongo的路径设置为别名,因为在我注销时这些路径被删除

alias mongod='/home/ec2-user/mongodb/mongodb-linux-x86_64-3.0.0/bin/mongod'
alias mongo='/home/ec2-user/mongodb/mongodb-linux-x86_64-3.0.0/bin/mongo'
我可以用这个别名启动mongo服务器,没问题

但是,当我运行node server.js时,我得到

/home/ec2-user/project/node_modules/mongodb/lib/mongodb/connection/base.js:246
        throw message;
              ^
AssertionError: {"name":"MongoError","ok":0,"errmsg":"ns not found"} == null
    at /home/ec2-user/project/server.js:38:13
    at /home/ec2-user/project/node_modules/mongodb/lib/mongodb/db.js:1217:20
    at /home/ec2-user/project/node_modules/mongodb/lib/mongodb/db.js:1194:16
    at /home/ec2-user/project/node_modules/mongodb/lib/mongodb/db.js:1903:9
    at Server.Base._callHandler (/home/ec2-user/project/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
    at /home/ec2-user/project/node_modules/mongodb/lib/mongodb/connection/server.js:487:18
    at MongoReply.parseBody (/home/ec2-user/project/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at null.<anonymous> (/home/ec2-user/project/node_modules/mongodb/lib/mongodb/connection/server.js:445:20)
    at emit (events.js:95:17)
    at null.<anonymous> (/home/ec2-user/project/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)

错误
ns not found
表示某些操作是在不存在的命名空间(ns)上运行的,就像您打算在
数据库上操作。collection
,但尝试在
数据库上操作。collection
。基于代码中错误发生的位置,这有意义吗?如果没有,你能从你的server.js发布有问题的行吗

2015-03-29T20:40:45.782+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:37394 #34 (1 connection now open)
2015-03-29T20:40:45.782+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:37395 #35 (2 connections now open)
2015-03-29T20:40:45.783+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:37396 #36 (3 connections now open)
2015-03-29T20:40:45.783+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:37397 #37 (4 connections now open)
2015-03-29T20:40:45.784+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:37398 #38 (5 connections now open)
2015-03-29T20:40:46.721+0000 I COMMAND  [conn35] CMD: drop data.page-1
2015-03-29T20:40:46.749+0000 I COMMAND  [conn36] CMD: drop data.page-2
2015-03-29T20:40:46.772+0000 I COMMAND  [conn37] CMD: drop data.page-4
2015-03-29T20:40:46.803+0000 I COMMAND  [conn38] CMD: drop data.page-3
2015-03-29T20:40:46.822+0000 I COMMAND  [conn34] CMD: drop data.page-5
2015-03-29T20:40:46.829+0000 I NETWORK  [conn34] end connection 127.0.0.1:37394 (4 connections now open)
2015-03-29T20:40:46.829+0000 I NETWORK  [conn35] end connection 127.0.0.1:37395 (3 connections now open)
2015-03-29T20:40:46.829+0000 I NETWORK  [conn36] end connection 127.0.0.1:37396 (2 connections now open)
2015-03-29T20:40:46.829+0000 I NETWORK  [conn37] end connection 127.0.0.1:37397 (1 connection now open)
2015-03-29T20:40:46.829+0000 I NETWORK  [conn38] end connection 127.0.0.1:37398 (0 connections now open)