Hi,

MongoDB has a Java library but not all the commands are supported, so, if you want to run some command from java (or node) first we must type in the console this

for example, we want to run the command db.copydatabase(from, to)

we type in the console

> db.copyDatabase

and the result is

So, with this we have how to execute the command

first because is a admin command we have to use the admin database (_adminCommand)

with this

_adminCommand( { copydb:1, fromhost:fromhost, fromdb:fromdb, todb:todb } );

translate to Java API