-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
-
When running
db.foo.runCommand({rolesInfo:1, showBuiltinRoles:true})
MongoDB 3.4 (but not any previous version I tested) will return a document with two "roles" fields:
{ "roles": [<This is the data we want>], "roles": [], ... }
Note that the above command will not actually produce a document with two "roles" keys, but on the "wire" (meaning the BSON binary chunk) it will be a duplicate that is then (maybe) disambiguated "in some way" by the driver you use.
Unfortunately, the first "roles" entry has the data, while the second one is empty. The java driver behaves differently compared to the C based drivers, since Map::put() will overwrite existing entries, thus making the last occurrence matter, while the C based drivers use a forward scan that will always return the first occurrence.
Further, I want to point out that this is NOT a bug in the java driver, but since the broken MongoDB has already been shipped to production, we still need a fix to deal with the broken MongoDBs that are in circulation.
- duplicates
-
SERVER-27271 rolesInfo command raises System.InvalidOperationException : Duplicate element name 'roles'.
- Closed