-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 1.3.1, 1.5.0
-
Component/s: CLI Module
-
None
-
3
-
Iteration Grouper, Iteration Herring, Iteration Isopod, Iteration Jellyfish
-
Needed
-
When you run rs.status() on a replicaset which is not yet initialized then you get an error:
mongosh --norc localhost:27017 test> rs.status() Uncaught: MongoServerError: no replset config has been received at MessageStream.messageHandler (C:\Programs\MongoDB\Server\bin\mongosh.exe:101152:20) at MessageStream.emit (events.js:400:28) at MessageStream.emit (domain.js:475:12) at processIncomingData (C:\Programs\MongoDB\Server\bin\mongosh.exe:100448:12) at MessageStream._write (C:\Programs\MongoDB\Server\bin\mongosh.exe:100344:5) at writeOrBuffer (internal/streams/writable.js:358:12) at MessageStream.Writable.write (internal/streams/writable.js:303:10) at Socket.ondata (internal/streams/readable.js:731:22) at Socket.emit (events.js:400:28) at Socket.emit (domain.js:475:12)
However, according documentation and in legacy mongo shell it should return a JSON with proper error code:
mongo --norc localhost:27017 > rs.status() { "ok" : 0, "errmsg" : "no replset config has been received", "code" : 94, "codeName" : "NotYetInitialized" }
I deploy MongoDB with scripts, and not getting a proper JSON response makes it much more difficult to automate the deployment process.