標籤:prototype style option img 報錯 bsp handle 串連 怎麼辦
mongoose 的報當我從 [email protected] 升級到 [email protected]的時候,出現了一個問題:
Unhandled rejection MongoError: no mongos proxies found in seed list
怎麼辦,我google 一下的時候發現:
https://github.com/christkv/mongodb-core/issues/118
原來是mongo的一個bug
哎呦!看下源碼,這是[email protected]
Mongoose.prototype.createConnection = function(uri, options) {
var conn = new Connection(this);
this.connections.push(conn);
var rsOption = options && (options.replset || options.replSet);
if (arguments.length) {
if (rgxReplSet.test(arguments[0]) || checkReplicaSetInUri(arguments[0])) {
conn.openSet.apply(conn, arguments);
} else if (rsOption &&
(rsOption.replicaSet || rsOption.rs_name)) {
conn.openSet.apply(conn, arguments);
} else {
conn.open.apply(conn, arguments);
}
}
return conn;
};
再看下低版本的[email protected]
Mongoose.prototype.createConnection = function(uri, options) {
var conn = new Connection(this);
this.connections.push(conn);
if (arguments.length) {
if (rgxReplSet.test(arguments[0]) || checkReplicaSetInUri(arguments[0])) {
conn.openSet.apply(conn, arguments);
} else if (options && options.replset &&
(options.replset.replicaSet || options.replset.rs_name)) {
conn.openSet.apply(conn, arguments);
} else {
conn.open.apply(conn, arguments);
}
}
return conn;
};
也就是說,在低版本中,你的mongodb 做了複製集的配置和不做複製集的配置都能串連到mongodb,在高本中如果你做了複製集,options 中的參數需要加一個
replset或者replSet S為true,而沒有做複製集的要為false。
mongodb 有一個坑 報錯 no mongos proxies found in seed list