Rohan M
unread,Oct 7, 2012, 7:01:43 AM10/7/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
Hi All,
I want to clone a collection from remote server to host server using perl.
If I try to run the commands from Mongo Console, it works, so no issues of network here.
Trial 1)
my $cmd = Tie::IxHash->new(
'cloneCollection' => $tableToClone,
'from' => 'X.X.X.X:27017',
);
my $result = $db->run_command($cmd);
The $db is same as the remote database. When I run this , the database with collection name ($tableToClone) gets created , which is wrong.
I tried another method,
my $command = <<CSTART;
db.cloneCollection('X.X.X.X:27017', '$tableToClone');
CSTART
$db->run_command( { 'eval' => MongoDB::Code->new( code => $command )
} );
This also doesn't clone collection
Could somebody help me on this?
Thanks
Rohan;