Details
-
Task
-
Resolution: Works as Designed
-
Major - P3
-
None
-
None
-
None
-
From http://mongodb.github.io/node-mongodb-native/2.0/reference/ecmascript6/connecting/ the sample code
-
Empty show more show less
Description
ar MongoClient = require('mongodb').MongoClient,
co = require('co'),
assert = require('assert');
co(function*()
{ // Connection URL var url = 'mongodb://localhost:27017/myproject'; // Use connect method to connect to the Server var db = yield MongoClient.connect(url); // Close the connection db.close(); }).catch(function(err)
{ console.log(err.stack); });
if I replace the url like, const url = 'mongodb://alexlai:password@arch16GMongo01.yushei.me:27017,arch16GMongo02.yushei.me:27017,arch16GMongo03.yushei.me,arch16GMongo04.yushei.me:27017/YuShei?replicaSet=odroid00&connectTimeoutMS=1000';
The code will open, but can not close the db connection. Without replication is fine.