When running the listIndexes command on a database that does not exist, the error code has changed in a sharded system. Not only that, the error code is different between a mongos and a mongod. Drivers are relying on this error code to provide an empty list to a user rather than an exception as is specified.
3.0.5
mongos> db.runCommand({listIndexes: "foo"}) { "ok" : 0, "errmsg" : "no database", "code" : 26 }
Latest
2015-09-17T12:40:46.583-0500 I CONTROL [initandlisten] db version v3.1.8-pre- 2015-09-17T12:40:46.583-0500 I CONTROL [initandlisten] git version: 4dc43cd451f58d59d63e1516f9b0c52f3bb1dd9d
mongos> db.runCommand({listIndexes: "foo"}) { "ok" : 0, "errmsg" : "database test not found", "code" : 60 }
> db.runCommand({listIndexes: "foo"}) { "ok" : 0, "errmsg" : "no database", "code" : 26 }
- related to
-
PHPLIB-107 DropCollection should not throw exception for nonexistent collection
- Closed
-
PHPLIB-123 ListIndexes should not throw exception for nonexistent collection
- Closed