0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

find _id index more robustly

This commit is contained in:
Eliot Horowitz 2009-10-29 11:59:38 -04:00
parent c423f4cb6f
commit aa6fc17f57

View File

@ -587,6 +587,13 @@ namespace mongo {
id = ⅈ
break;
}
if ( keyPattern.nFields() == 1 && ii.keyPattern().nFields() == 1 &&
IndexDetails::isIdIndexPattern( keyPattern ) &&
ii.isIdIndex() ){
id = ⅈ
break;
}
}
}
@ -597,7 +604,7 @@ namespace mongo {
}
if ( !id ) {
errmsg = "no index found for specified keyPattern";
errmsg = (string)"no index found for specified keyPattern: " + keyPattern.toString();
return 0;
}