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

indexKey $meta projection not populating fields

    • Fully Compatible
    • ALL
    • Query 2019-12-02

      The indexKey meta projection does not seem to be filling in fields, even when an index seems to be being used.

      > db.test.ensureIndex({a:1})
      > db.test.insert({a:1})
      > db.test.find({a:1}, {b: {$meta: "indexKey"}})
      {  }
      > db.test.find({a:1}, {b: {$meta: "indexKey"}}).explain()
      {
              "cursor" : "BtreeCursor a_1",
              "isMultiKey" : false,
              "n" : 1,
              "nscannedObjects" : 0,
              "nscanned" : 1,
              "nscannedObjectsAllPlans" : 0,
              "nscannedAllPlans" : 1,
              "scanAndOrder" : false,
              "indexOnly" : true,
              "nYields" : 0,
              "nChunkSkips" : 0,
              "millis" : 0,
              "indexBounds" : {
                      "a" : [
                              [
                                      1,
                                      1
                              ]
                      ]
              },
              "server" : "Andrew-Emil-MacBook-Pro.local:27017"
      }
      

            Assignee:
            anton.korshunov@mongodb.com Anton Korshunov
            Reporter:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: