diff --git a/bin/c-mongo-download-config.js b/bin/c-mongo-download-config.js index 9330950..6568dce 100644 --- a/bin/c-mongo-download-config.js +++ b/bin/c-mongo-download-config.js @@ -49,7 +49,13 @@ const volumeName = ({ collection, env, name }) => { (async () => { const [, , env, collection] = process.argv; const details = await loadConfig(`mongo.${env}`); - const connection = connectionParts(details); + const params = [...(details.params || [])]; + + if (collection) { + params.push(`-c=${collection}`); + } + + const connection = connectionParts({ ...details, params }); const dockerVolumeName = volumeName({ collection, env, diff --git a/bin/c-mongo-import-config.js b/bin/c-mongo-import-config.js index fd7f332..5047b1c 100644 --- a/bin/c-mongo-import-config.js +++ b/bin/c-mongo-import-config.js @@ -33,7 +33,7 @@ const connectionStringWithHost = ({ auth, host, name, params }) => { cmd.push(params); } - return [...cmd, '--host', host, '-d', name].join(' '); + return [...cmd, '--host', host].join(' '); }; (async () => { @@ -47,8 +47,8 @@ const connectionStringWithHost = ({ auth, host, name, params }) => { const collectionArg = collection === '' - ? `--nsInclude '${fromDb.name}.*' --nsFrom '${fromDb.name}.*' --nsTo '${toDb.name}.*'` - : `--nsInclude '${fromDb.name}.${collection}' --nsFrom '${fromDb.name}.*' --nsTo '${toDb.name}.*'`; + ? `--nsInclude ${fromDb.name}.* --nsFrom '${fromDb.name}.*' --nsTo '${toDb.name}.*'` + : `--nsInclude ${fromDb.name}.${collection} --nsFrom '${fromDb.name}.*' --nsTo '${toDb.name}.*'`; const args = [ '-it', @@ -73,7 +73,7 @@ const connectionStringWithHost = ({ auth, host, name, params }) => { ? connectionStringWithHost(toDbConnection) : connectionStringWithAddress(toDbConnection), collectionArg, - `data/${fromDb.name}` + 'data/' ); console.log(