Details
-
Bug
-
Resolution: Won't Fix
-
Major - P3
-
None
-
1.6.5
-
None
-
ALL
Description
DBCollection.prototype._genIndexName generates index name automatically if it is not supplied.
It concatenates keys and direction. For example,
results with field1_1_field2_-1_field3_1
If instead of direction with have a string (2d) we might have duplicate "" or unneeded "" at the end.
Example 1:
"field1_1_field2_"
Example2:
{field1: 1, field2: "2d", field3: -1}"field1_1_field2_field3-1"
It's not a big deal but other drivers might implement it in a different way
and the duplicated "_" might cause a confusion.
https://github.com/mongodb/mongo/blob/master/shell/collection.js#L218
Fix:
DBCollection.prototype._genIndexName = function( keys ){
var name = "";
for ( var k in keys )
return name;
}