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

"insert" command into system.indexes not prohibited

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance, Storage
    • Storage Execution
    • ALL
    • Hide
      > db.collection.dropIndexes()
      {
      	"nIndexesWas" : 3,
      	"msg" : "non-_id indexes dropped for collection",
      	"ok" : 1
      }
      > db.runCommand({insert: 'system.indexes', documents: [ { key: {b: 1}, name: 'b_1', ns: 'test.collection' } ] })
      { "ok" : 1, "n" : 1 }
      > db.collection.getIndexes()
      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"name" : "_id_",
      		"ns" : "test.collection"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"b" : 1
      		},
      		"name" : "b_1",
      		"ns" : "test.collection"
      	}
      ]
      > db.serverBuildInfo()
      {
      	"version" : "2.6.0-rc2-pre-",
      	"gitVersion" : "d8eb19991b01f9fc5e73f0a3acd3f8a59e2d7c7d",
      	"OpenSSLVersion" : "",
      	"sysInfo" : "Darwin As-MacBook-Pro-2.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
      	"loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load -fstack-protector -mmacosx-version-min=10.6",
      	"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O0 -fstack-protector -Wno-unused-function -Wno-unused-private-field -Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare -mmacosx-version-min=10.6",
      	"allocator" : "tcmalloc",
      	"versionArray" : [
      		2,
      		6,
      		0,
      		-8
      	],
      	"javascriptEngine" : "V8",
      	"bits" : 64,
      	"debug" : true,
      	"maxBsonObjectSize" : 16777216,
      	"ok" : 1
      }
      
      Show
      > db.collection.dropIndexes() { "nIndexesWas" : 3, "msg" : "non-_id indexes dropped for collection" , "ok" : 1 } > db.runCommand({insert: 'system.indexes' , documents: [ { key: {b: 1}, name: 'b_1' , ns: 'test.collection' } ] }) { "ok" : 1, "n" : 1 } > db.collection.getIndexes() [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_" , "ns" : "test.collection" }, { "v" : 1, "key" : { "b" : 1 }, "name" : "b_1" , "ns" : "test.collection" } ] > db.serverBuildInfo() { "version" : "2.6.0-rc2-pre-" , "gitVersion" : "d8eb19991b01f9fc5e73f0a3acd3f8a59e2d7c7d" , "OpenSSLVersion" : "", "sysInfo" : "Darwin As-MacBook-Pro-2.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49" , "loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load -fstack-protector -mmacosx-version-min=10.6" , "compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O0 -fstack-protector -Wno-unused-function -Wno-unused- private -field -Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare -mmacosx-version-min=10.6" , "allocator" : "tcmalloc" , "versionArray" : [ 2, 6, 0, -8 ], "javascriptEngine" : "V8" , "bits" : 64, "debug" : true , "maxBsonObjectSize" : 16777216, "ok" : 1 }

      The drivers team thought that inserting into system.indexes with the "insert" command (as opposed to legacy OP_INSERT) would be prohibited, forcing us to migrate to the createIndexes command. But insertion into system.indexes with the "insert" command is still allowed.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: