Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-25667

How to get the number of key/value pairs in an index?

      Windows 10
      MS VS 2015
      MongoDB 3.3.5
      MongoDB C++11 Driver 3.0.1
      Using WiredTiger

      I want the statistic

      "btree" { "number of key/value pairs"}

      which is equal to "btree_entries" from bt_stat.c. (I recognize this is "really, really expensive").

      I run this in mongo:

      db.adminCommand({ setParameter: 1, "wiredTigerEngineRuntimeConfig" : "create,statistics=(all)"})

      and mongod reports it was successful:

      2016-08-17T11:18:00.960-0700 I STORAGE  [conn5176] Reconfiguring WiredTiger storage engine with config string: "statistics=(all)"

      which, presumably, sets WT_CONN_STAT_ALL so that btree_entries will be collected.

      According to the documentation, I have to use the db.adminCommand. "You can only set this parameter using the setParameter command and not using the command line or configuration file option."

      But when I then run:

      db.employees.stats({'indexDetails':true, 'indexDetailsName': "employeenum_1_check_1"})

      I still get:

      "number of key/value pairs" : 0,

            Assignee:
            Unassigned Unassigned
            Reporter:
            therefore George Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: