[DOCS-8430] your shell javascript has some problem code in collection.js Created: 27/Jul/16  Updated: 03/Nov/17  Resolved: 13/Aug/16

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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


Issue Links:
Related
related to SERVER-25300 Incorrect syntax in for loop in colle... Closed
Participants:
Days since reply: 7 years, 26 weeks, 4 days ago

 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++)

{ indexSpecs[i] = this._indexSpec(keys[i], options); }

if (this.getMongo().writeMode() == "commands") {
for (i = 0; i++; i < indexSpecs.length)

{ delete (indexSpecs[i].ns); // ns is passed to the first element in the command. }
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



 Comments   
Comment by Ravind Kumar (Inactive) [ 13/Aug/16 ]

Thank you for filing a DOCS ticket.

The issue in question is actually more server related than docs - as of such, SERVER-25300 was created and resolved.

If you come across similar issues in the MongoDB source code, please raise a ticket in the SERVER project.

Generated at Thu Feb 08 07:56:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.