Connection refused between Node and MongoDB

20
May 15, 2019, at 9:40 PM

Getting this error when I try to connect my Node to my MongoDB

(But pretty new with both mongo and node so I might be doing something wrong...)

MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017 at Socket.err (/var/www/rzp/api/web/server_node/node_modules/mongodb-core/lib/connection/connect.js:287:16) at Object.onceWrapper (events.js:273:13) at Socket.emit (events.js:182:13) at emitErrorNT (internal/streams/destroy.js:82:8) at emitErrorAndCloseNT (internal/streams/destroy.js:50:3) at process._tickCallback (internal/process/next_tick.js:63:19)

Symfony Side

config.yml

doctrine_mongodb:
    connections:
        default:
            server: "%mongodb_server%"
            options: {}
    default_database: rzp_users
    document_managers:
        default:
            auto_mapping: true

parameters.yml

mongodb_server: "mongodb://127.0.0.1:27017"

Node server.js

// Connection URL
const url = 'mongodb://127.0.0.1:27017';

MongoClient.connect(url, { useNewUrlParser: true }, function (err,client){

I think my Mongo configuration for Symfony is fine (not sure)

php bin/console doctrine:mongodb:generate:documents AppRefactoredBundle
Generating documents for "AppRefactoredBundle"
generating AppRefactoredBundle\Document\UserConnected

Thanks for your help.

READ ALSO
What claims do refresh token contain?

What claims do refresh token contain?

I am implementing JWT in one of my node appsI am wondering, if there is any definite format/ structure in which a refresh token should be generated?

27
How to get past errors using putParameter with aws-sdk for nodejs in Lambda?

How to get past errors using putParameter with aws-sdk for nodejs in Lambda?

I'm trying to set a parameter using putParameter in the AWS SDK for JavaScript in Nodejs

48
Pass type to function or create type from object

Pass type to function or create type from object

I have function, in which I need to use type, passed like one of function parameters:

28
NodeJS plans to support import/export es6 (es2015) modules

NodeJS plans to support import/export es6 (es2015) modules

I've been looking all over the internet without a clear answer for this

18