-
Type:
Improvement
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: 2.4.5
-
Component/s: Diagnostics
-
Environment:> db.serverBuildInfo()
{
"version" : "2.4.5",
"gitVersion" : "a2ddc68ba7c9cee17bfe69ed840383ec3506602b",
"sysInfo" : "Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -rdynamic -m64",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64",
"allocator" : "system",
"versionArray" : [
2,
4,
5,
0
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
> db.serverBuildInfo() { "version" : "2.4.5", "gitVersion" : "a2ddc68ba7c9cee17bfe69ed840383ec3506602b", "sysInfo" : "Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49", "loaderFlags" : "-fPIC -pthread -rdynamic -m64", "compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64", "allocator" : "system", "versionArray" : [ 2, 4, 5, 0 ], "javascriptEngine" : "V8", "bits" : 64, "debug" : false, "maxBsonObjectSize" : 16777216, "ok" : 1 }
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
Problem:
In order to use db.c.getIndexStats() or the command indexStats you need to enable the mongd at startup with --enableExperimentalIndexStatsCmd per the documentation here
http://docs.mongodb.org/manual/reference/command/indexStats/#dbcmd.indexStats
However, if this is not enabled at startup you get the following message
> db.q.getIndexStats() error executing indexStats command: { "ok" : 0, "errmsg" : "no such cmd: indexStats", "bad cmd" : { "indexStats" : "q" } }
The message at best in not helpful, it should indicate that a startup parameter is missing (and may be a link to the documentation)....
Reproduce:
Do not add the startup parameter indicated above and simply do the following
db.q.drop() db.q.insert({a:1}) db.q.ensureIndex({a:1}); db.q.getIndexStats()