diff --git a/src/Cli/Executable/Mongodump.php b/src/Cli/Executable/Mongodump.php index a61df6f0..e2dd7720 100644 --- a/src/Cli/Executable/Mongodump.php +++ b/src/Cli/Executable/Mongodump.php @@ -266,7 +266,17 @@ protected function createCommandLine() : CommandLine } } - $cmd->addOptionIfNotEmpty('--excludeCollection', $this->excludeCollections); + if (count($this->excludeCollections)) { + foreach ($this->excludeCollections as $col) { + $cmd->addOption('--excludeCollection', $col, ' '); + } + } + + if (count($this->excludeCollectionsWithPrefix)) { + foreach ($this->excludeCollectionsWithPrefix as $col) { + $cmd->addOption('--excludeCollectionWithPrefix', $col, ' '); + } + } $cmd->addOptionIfNotEmpty('--excludeCollectionWithPrefix', $this->excludeCollectionsWithPrefix); return $process;