Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
macos 10.11
*Location*: https://docs.mongodb.com/manual/installation/?_ga=1.33512568.751647522.1464681992
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36
*Referrer*: https://www.mongodb.com/download-center?jmp=nav
*Screen Resolution*: 1440 x 900
macos 10.11 *Location*: https://docs.mongodb.com/manual/installation/?_ga=1.33512568.751647522.1464681992 *User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 *Referrer*: https://www.mongodb.com/download-center?jmp=nav *Screen Resolution*: 1440 x 900
Description
source code Version 3.2.3
file src/mongo/shell/mongo.js
line 596
bug code
DBCollection.prototype.createIndexes = function(keys, options) {
var indexSpecs = Array(keys.length);
for (var i = 0; i < indexSpecs.length; i++)
if (this.getMongo().writeMode() == "commands") {
for (i = 0; i++; i < indexSpecs.length)
return this._db.runCommand({createIndexes: this.getName(), indexes: indexSpecs});
}
else if(this.getMongo().writeMode() == "compatibility") {
// Use the downconversion machinery of the bulk api to do a safe write, report response as a
// command response
var result = this._db.getCollection("system.indexes").insert(indexSpecs , 0, true);
if (result.hasWriteErrors() || result.hasWriteConcernError()) {
// Return the first error
var error = result.hasWriteErrors() ? result.getWriteErrors()[0] :
result.getWriteConcernError();
return {ok : 0.0, code : error.code, errmsg : error.errmsg};
}
else {
return {ok : 1.0};
}
}
else { this._db.getCollection("system.indexes").insert(indexSpecs, 0, true); }
}
your code
for (i = 0; i++; i < indexSpecs.length) { delete (indexSpecs[i].ns); // ns is passed to the first element in the command. }
WILL NEVER BE EXECUTED
Attachments
Issue Links
- related to
-
SERVER-25300 Incorrect syntax in for loop in collection.js
-
- Closed
-