E
E
Emptyform2016-08-01 12:22:44
MongoDB
Emptyform, 2016-08-01 12:22:44

How to connect to MongoDb on a remote server?

Installed the latest MongoDb on a separate server ( win 7 )
Raised it as a service according to the instructions devcolibri.com/2091
I run mongo.exe on the same server in the console and can view the contents of the database, create objects, delete, etc.
I'm trying to connect from a script from another computer,

'use strict';

var url = 'mongodb://10.55.###.###:27017/test',
    MongoClient = require('mongodb').MongoClient;

MongoClient.connect(url, (err, db) => {
    if (err) {
        console.error(err);
    } else {
        console.log('Connected correctly to server');
        db.close();
    }
});

In response I get:
[MongoError: failed to connect to server [10.55.###.###:27017] on first connect]

What am I doing wrong?
upd I thought, maybe I'm not right, I checked - I connected using telnet to the server on port 27017 - everything is OK, it connects ...
upd2 I'll add, just in case, that on my computer the operating system is WinXP SP3

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question