Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16727

Add partialFilterExpression to the set of examples for $indexStats

      Hello,

      It would be helpful to include an example with the partialFilterExpression field to the set of examples for $indexStats. Example from a DB that we run in Atlas prod:

      [
        {
          name: 'latestSuggested_1',
          key: { latestSuggested: 1 },
          host: 'M-QQCWX6CL6W:27022',
          accesses: { ops: Long('0'), since: ISODate('2024-04-04T23:04:23.416Z') },
          shard: 'cluster_test_1',
          spec: {
            v: 2,
            key: { latestSuggested: 1 },
            name: 'latestSuggested_1',
            expireAfterSeconds: Long('604800'),
            partialFilterExpression: { accepted: { '$eq': null } }
          }
        },
        {
          name: 'accepted_1',
          key: { accepted: 1 },
          host: 'M-QQCWX6CL6W:27022',
          accesses: { ops: Long('0'), since: ISODate('2024-04-04T23:04:23.470Z') },
          shard: 'cluster_test_1',
          spec: {
            v: 2,
            key: { accepted: 1 },
            name: 'accepted_1',
            expireAfterSeconds: Long('126144000'),
            partialFilterExpression: { accepted: { '$exists': true } }
          }
        },
        {
          name: '_id_',
          key: { _id: 1 },
          host: 'M-QQCWX6CL6W:27022',
          accesses: { ops: Long('0'), since: ISODate('2024-04-04T23:04:23.373Z') },
          shard: 'cluster_test_1',
          spec: { v: 2, key: { _id: 1 }, name: '_id_' }
        },
        {
          name: 'bucket_1_accepted_1',
          key: { bucket: 1, accepted: 1 },
          host: 'M-QQCWX6CL6W:27022',
          accesses: { ops: Long('0'), since: ISODate('2024-04-04T23:04:23.538Z') },
          shard: 'cluster_test_1',
          spec: {
            v: 2,
            key: { bucket: 1, accepted: 1 },
            name: 'bucket_1_accepted_1',
            partialFilterExpression: { accepted: { '$exists': true } }
          }
        },
        {
          name: 'rcid_1_hostPort_1_namespace_1_indexDefinitionHash_1',
          key: { rcid: 1, hostPort: 1, namespace: 1, indexDefinitionHash: 1 },
          host: 'M-QQCWX6CL6W:27022',
          accesses: { ops: Long('0'), since: ISODate('2024-04-04T23:04:23.605Z') },
          shard: 'cluster_test_1',
          spec: {
            v: 2,
            unique: true,
            key: { rcid: 1, hostPort: 1, namespace: 1, indexDefinitionHash: 1 },
            name: 'rcid_1_hostPort_1_namespace_1_indexDefinitionHash_1'
          }
        }
      ] 

      Notice how some of them have a partialFilterExpression. It would be useful to include that in the examples!

            Assignee:
            jeffrey.allen@mongodb.com Jeffrey Allen
            Reporter:
            shashank.saxena@mongodb.com Shashank Saxena
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              5 days ago