TAGS :Viewed: 2 - Published at: a few seconds ago

[ Mongodb issues on AWS ]

I have been trying to install Mongodb on my AWS EC2 instance to work with a Node.js server I wrote.

Following this guide I was able to "install" monogdb

However I set to aliases to the paths of mongod and mongo since the paths were dropped when I logged out

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'

I can start the mongo server using this alias no problem.

However when I run node server.js, I get

/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)

I've searched around a bit for this error but, couldn't find anything. The odd part is I can see the incoming connection in the screened mongod proccess. As such

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)

Answer 1


The error ns not found means some operation was run on a nonexistent namespace (ns), like you meant to operate on database.collection but instead tried to operate on database.colletcion. Does that make sense based on where the error happens in your code? If not, could you post the offending lines from your server.js?