From 4198f64f418c61f1ef4405731c82b5fe3346d150 Mon Sep 17 00:00:00 2001 From: Marcel Djaman Date: Fri, 11 Aug 2023 13:16:26 +0000 Subject: [PATCH] fix excludecollections in mongodump --- src/Cli/Executable/Mongodump.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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;