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

CopyDB doesn't seem to work when copying from sharded db.

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8.2
    • Component/s: None
    • None
    • Environment:
      at least ubuntu linux 10.10
    • ALL

      See http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBwQFjAA&url=http%3A%2F%2Fgroups.google.com%2Fgroup%2Fmongodb-user%2Fbrowse_thread%2Fthread%2F3a831d2675b0ec12&rct=j&q=google%20groups%20copydatabase%20failed&ei=mltBTvzrF4Hq0gHO-Om2CQ&usg=AFQjCNEAdHW-X8VFfuZ52talNbQ6GIyp7g&cad=rja

      Copying is incomplete or does not happen at all.

      Workaround is to script something like:

      var mongoTo = mongod; var mongoFrom = mongos;
      var collections = mongoFrom.getDB( "test" ).getCollectionNames()
      var dbTo = "test2"; var dbFrom = "test"
      var collections = mongoFrom.getDB( dbFrom ).getCollectionNames()
      for( var i = 0; i < collections.length; i++ ){
      var cursor = mongoFrom.getCollection( dbFrom + "." + collections[i] ).find()
      while( cursor.hasNext() )

      { mongoTo.getCollection( dbTo + "." + collections[i] ).insert( cursor.next() ) }

      }

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            greg_10gen Greg Studer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: