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.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.2.3, 2.4.0-rc1
    • 2.4.0-rc2
    • Index Maintenance
    • None
    • Minor Change
    • ALL

    Description

      > 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"
      }

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: