Skip to content

Commit 2277a22

Browse files
committed
fixup! Use a more suitable method of detecting if authentication is needed
1 parent 621060e commit 2277a22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

templates/mongoshrc.js.erb

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ function authRequired() {
2323
} catch (err) {
2424
if (err.message.match(/requires authentication/) || err.message.match(/not authorized on admin/)) {
2525
return true
26-
} else {
27-
throw("Unknown error :" + err)
26+
if (err.message.match(/not running with --replSet/) {
27+
return false
2828
}
29+
throw("Unknown error :" + err)
30+
}
2931
}
3032
}
3133

0 commit comments

Comments
 (0)