public function moveToCollection(
        $targetCollectionName,
        $targetDatabaseName = null,
        $batchLimit = 100
    ) {
        // copy to target
        $this->copyToCollection($targetCollectionName, $targetDatabaseName, $batchLimit);

        // remove from source
        $this->collection->batchDelete($this->expression);
    }
public function moveToCollection(
        $targetCollectionName,
        $targetDatabaseName = null,
        $batchLimit = 100
    ) {
        // copy to target
        $this->copyToCollection($targetCollectionName, $targetDatabaseName, $batchLimit);

        // remove from source
        $this->collection->batchDelete($this->expression);
    }
public function moveToCollection ( $ targetCollectionName , $ targetDatabaseName = null , $ batchLimit = 100 ) { // copy to target $ this -> copyToCollection ( $ targetCollectionName , $ targetDatabaseName , $ batchLimit ) ; // remove from source $ this -> collection -> batchDelete ( $ this -> expression ) ; }
Move selected documents to another collection.
Documents will be removed from source collection only after
copying them to target collection.

@param string $targetCollectionName
@param string|null $targetDatabaseName Target database name. If not specified - use current
@param int $batchLimit count of documents to get from old and insert to new collection per time
Move selected documents to another collection . Documents will be removed from source collection only after copying them to target collection .