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

copyCollection cannot append namespaces with options

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.1
    • Component/s: Internal Code
    • Environment:
      linux centos 64bit
    • Fully Compatible
    • Linux
    • Hide

      Example:

       db.runCommand({cloneCollection: 'mydb.map', from:'[source address]', query: { _id: 'TDL-TRIPWL-2013'  }});
      { "ok" : 1 }
      

      Above works even though .map collection exists.

      db.runCommand({cloneCollection: 'mydb.category', from:'[source address]', query: { event_name: 'TDL-TRIPWL-2013'  }});
      { "ok" : 0, "errmsg" : "collection already exists" }
      

      But this does not...what is the difference?

      I thought maybe it's the use of _id.. but this didn't work either:

      db.runCommand({cloneCollection: 'mydb.category', from:'[source address]', query: { _id:  ObjectId("5154d54aecfdf41427000041")  }});
      { "ok" : 0, "errmsg" : "collection already exists" }
      

      Info on my 2 collections:

      {
      	"ns" : "rt01.map",
      	"count" : 9,
      	"size" : 7840,
      	"avgObjSize" : 871.1111111111111,
      	"storageSize" : 36864,
      	"numExtents" : 1,
      	"nindexes" : 1,
      	"lastExtentSize" : 36864,
      	"paddingFactor" : 1.0020000000000011,
      	"systemFlags" : 1,
      	"userFlags" : 0,
      	"totalIndexSize" : 8176,
      	"indexSizes" : {
      		"_id_" : 8176
      	},
      	"ok" : 1
      }
      
      {
      	"ns" : "rt01.category",
      	"count" : 575,
      	"size" : 233208,
      	"avgObjSize" : 405.5791304347826,
      	"storageSize" : 696320,
      	"numExtents" : 4,
      	"nindexes" : 3,
      	"lastExtentSize" : 524288,
      	"paddingFactor" : 1.5120000000000196,
      	"systemFlags" : 1,
      	"userFlags" : 0,
      	"totalIndexSize" : 130816,
      	"indexSizes" : {
      		"_id_" : 32704,
      		"name_1_event_name_1" : 49056,
      		"event_name_1_name_1" : 49056
      	},
      	"ok" : 1
      }
      
      Show
      Example: db.runCommand({cloneCollection: 'mydb.map' , from: '[source address]' , query: { _id: 'TDL-TRIPWL-2013' }}); { "ok" : 1 } Above works even though .map collection exists. db.runCommand({cloneCollection: 'mydb.category' , from: '[source address]' , query: { event_name: 'TDL-TRIPWL-2013' }}); { "ok" : 0, "errmsg" : "collection already exists" } But this does not...what is the difference? I thought maybe it's the use of _id.. but this didn't work either: db.runCommand({cloneCollection: 'mydb.category' , from: '[source address]' , query: { _id: ObjectId( "5154d54aecfdf41427000041" ) }}); { "ok" : 0, "errmsg" : "collection already exists" } Info on my 2 collections: { "ns" : "rt01.map" , "count" : 9, "size" : 7840, "avgObjSize" : 871.1111111111111, "storageSize" : 36864, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 36864, "paddingFactor" : 1.0020000000000011, "systemFlags" : 1, "userFlags" : 0, "totalIndexSize" : 8176, "indexSizes" : { "_id_" : 8176 }, "ok" : 1 } { "ns" : "rt01.category" , "count" : 575, "size" : 233208, "avgObjSize" : 405.5791304347826, "storageSize" : 696320, "numExtents" : 4, "nindexes" : 3, "lastExtentSize" : 524288, "paddingFactor" : 1.5120000000000196, "systemFlags" : 1, "userFlags" : 0, "totalIndexSize" : 130816, "indexSizes" : { "_id_" : 32704, "name_1_event_name_1" : 49056, "event_name_1_name_1" : 49056 }, "ok" : 1 }
    • Storage 2017-03-27

      According to docs, cloneCollection "appends documents in the remote collection to the destination collection." if the collection already exists. I am seeing odd behavior when trying to do this.

            Assignee:
            maria.vankeulen@mongodb.com Maria van Keulen
            Reporter:
            tpneumat Jeremy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: