|
@@ -6,11 +6,8 @@ var mg = require('mongoose');
|
|
|
module.exports = {
|
|
|
getConnection : function(server, port, dbName) {
|
|
|
//*/
|
|
|
- if (port) {
|
|
|
- return mg.createConnection(server + ":" + port,dbName);
|
|
|
- } else {
|
|
|
- return mg.createConnection(server,dbName);
|
|
|
- }
|
|
|
+ var dbURL = 'mongodb://' + server + ":" + port + '/' + dbName;
|
|
|
+ return mg.createConnection(dbURL);
|
|
|
/*/
|
|
|
if (port) {
|
|
|
mg.connect('mongodb://' + server + ":" + port + '/' + dbName);
|
|
@@ -22,7 +19,7 @@ module.exports = {
|
|
|
},
|
|
|
getQAConnection: function(dbName) {
|
|
|
//*/
|
|
|
- return mg.createConnection("192.168.1.184:60666",dbName);
|
|
|
+ return mg.createConnection("mongodb://192.168.1.184:60666/" + dbName);
|
|
|
/*/
|
|
|
mg.connect('mongodb://192.168.1.184:60666/' + dbName);
|
|
|
return mg;
|
|
@@ -30,7 +27,7 @@ module.exports = {
|
|
|
},
|
|
|
getLocalConnection: function(dbName) {
|
|
|
//*/
|
|
|
- return mg.createConnection("localhost:27017",dbName);
|
|
|
+ return mg.createConnection("mongodb://localhost/" + dbName);
|
|
|
/*/
|
|
|
mg.connect('mongodb://localhost:27017/' + dbName);
|
|
|
return mg;
|
|
@@ -39,7 +36,9 @@ module.exports = {
|
|
|
getCfgConnection: function(dbName) {
|
|
|
var config = require("../config.js");
|
|
|
//*/
|
|
|
- return mg.createConnection(config.current.server + ":" + config.current.port, dbName);
|
|
|
+ var port = config.current.port;
|
|
|
+ var dbURL = 'mongodb://' + config.current.server + ":" + config.current.port + '/' + dbName;
|
|
|
+ return mg.createConnection(dbURL);
|
|
|
/*/
|
|
|
mg.connect('mongodb://' + config.current.server + ":" + config.current.port + '/' + dbName);
|
|
|
return mg;
|