Details
-
Task
-
Resolution: Done
-
Minor - P4
-
None
-
None
Description
I believe this was introduced in 2.1, but I'm not certain.
> db.foo.copyTo
|
function ( newName ){
|
return this.getDB().eval(
|
function( collName , newName ){
|
var from = db[collName];
|
var to = db[newName];
|
to.ensureIndex( { _id : 1 } );
|
var count = 0;
|
|
|
var cursor = from.find();
|
while ( cursor.hasNext() ){
|
var o = cursor.next();
|
count++;
|
to.save( o );
|
}
|
|
|
return count;
|
} , this.getName() , newName
|
);
|
}
|