[SERVER-9834] Change helper signature for indexStats commands Created: 31/May/13  Updated: 25/Jun/19  Resolved: 25/Jun/19

Status: Closed
Project: Core Server
Component/s: JavaScript, Shell
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 0
Labels: helper, indexstats, javascript, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-19504 Remove indexStats command artifacts Closed
Participants:

 Description   

Change the function to something like this:

DBCollection.prototype.indexStats = function(name, opt) {
    var idx = name;
    var cmd = { indexStats: this.getName() };
    // For backwards compat check if name is an object
    if (typeof(name) == 'object') {
        Object.extend(cmd, name);
        idx = name["index"];
    }
 
    cmd["index"] = idx;
    if (typeof(opt) == 'object') // support arbitrary options here
        Object.extend(cmd, opt);
 
    return this._db.runCommand( cmd );
}



 Comments   
Comment by James Wahlin [ 25/Jun/19 ]

Closing this ticket as the indexStats command and shell helper were removed under SERVER-19504.

Comment by Scott Hernandez (Inactive) [ 28/Apr/15 ]

So you can write this:

db.coll.indexStats("index_1") 
// instead of requiring the more verbose object version
db.coll.indexStats({index: "index_1"})

This came out of various confused users who tried to specify the index name as the argument, which was just ignored without error or warning.

Comment by Daniel Pasette (Inactive) [ 03/Jun/13 ]

scotthernandez, can you explain?

Generated at Thu Feb 08 03:21:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.