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

cloneCollection ignores the copyindexes field

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.6, 2.4.7, 2.5.3
    • Component/s: Admin
    • Storage Execution
    • ALL
    • Hide

      On ubuntu:11111:

      > db.dropDatabase()
      { "dropped": "test", "ok": 1 }
      > db.foo.insert({a:1})
      > db.foo.ensureIndex({a:1})
      

      On ubuntu:22222:

      > db.dropDatabase()
      { "dropped": "test", "ok": 1 }
      > db.runCommand({cloneCollection:'test.foo', from:'ubuntu:11111', copyindexes:false})
      { "ok": 1 }
      > db.system.indexes.find()
      { "v": 1, "key": { "_id": 1 }, "ns": "test.foo", "name": "_id_" }
      { "v": 1, "key": { "a": 1 }, "ns": "test.foo", "name": "a_1" }
      // Note the a_1 index was copied
      
      Show
      On ubuntu:11111: > db.dropDatabase() { "dropped" : "test" , "ok" : 1 } > db.foo.insert({a:1}) > db.foo.ensureIndex({a:1}) On ubuntu:22222: > db.dropDatabase() { "dropped" : "test" , "ok" : 1 } > db.runCommand({cloneCollection: 'test.foo' , from: 'ubuntu:11111' , copyindexes: false }) { "ok" : 1 } > db.system.indexes.find() { "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.foo" , "name" : "_id_" } { "v" : 1, "key" : { "a" : 1 }, "ns" : "test.foo" , "name" : "a_1" } // Note the a_1 index was copied
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      If you run cloneCollection with copyindexes:false, the indexes are still copied. There is a message logged:

      ERROR copy collection copyIndexes not implemented?  test.foo
      

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: