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

Inserts into any namespace ending in ".system.indexes" are treated like inserts into "system.indexes" and actually build indexes.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.0-rc2
    • Affects Version/s: 2.2.3, 2.4.0-rc1
    • Component/s: Index Maintenance
    • None
    • Minor Change
    • ALL

      > db.dropDatabase()
      { "dropped": "test", "ok": 1 }
      test[13:4:8]> db.foo.insert({a:1})
      Inserted 1 record(s) in 1057ms
      test[13:4:14]> db.system.indexes.find()
      { "v": 1, "key": { "_id": 1 }, "ns": "test.foo", "name": "_id_" }
      Fetched 1 record(s) in 1ms
      test[13:4:21]> db.foo.find({a:1}).explain()
      {
              "cursor": "BasicCursor",
              "isMultiKey": false,
              "n": 1,
              "nscannedObjects": 1,
              "nscanned": 1,
              "nscannedObjectsAllPlans": 1,
              "nscannedAllPlans": 1,
              "scanAndOrder": false,
              "indexOnly": false,
              "nYields": 0,
              "nChunkSkips": 0,
              "millis": 0,
              "indexBounds": {
      
              },
              "server": "ubuntu:54321"
      }
      test[13:4:27]> db.randomNS.system.indexes.insert({ns:"test.foo", key:{a:1}, name:"a_1"});
      Inserted 1 record(s) in 1ms
      test[13:4:41]> db.system.indexes.find()
      { "v": 1, "key": { "_id": 1 }, "ns": "test.foo", "name": "_id_" }
      Fetched 1 record(s) in 1ms
      test[13:4:55]> db.randomNS.system.indexes.find()
      { "v": 1, "key": { "a": 1 }, "ns": "test.foo", "name": "a_1" }
      Fetched 1 record(s) in 1ms
      test[13:5:3]> db.system.namespaces.find()
      { "name": "test.system.indexes" }
      { "name": "test.foo.$_id_" }
      { "name": "test.foo" }
      { "name": "test.randonNS.system.indexes" }
      { "name": "test.foo.$a_1" }
      Fetched 5 record(s) in 1ms
      test[13:5:10]> db.foo.find({a:1}).explain()
      {
              "cursor": "BtreeCursor a_1",
              "isMultiKey": false,
              "n": 1,
              "nscannedObjects": 1,
              "nscanned": 1,
              "nscannedObjectsAllPlans": 1,
              "nscannedAllPlans": 1,
              "scanAndOrder": false,
              "indexOnly": false,
              "nYields": 0,
              "nChunkSkips": 0,
              "millis": 0,
              "indexBounds": {
                      "a": [
                              [
                                      1,
                                      1
                              ]
                      ]
              },
              "server": "ubuntu:54321"
      }
      

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: