Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/MTWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ class MTWrapper {
command += ' --nsInclude ' + options.db + '.*';
}
}
if (isRestore && !isLegacyRestoreDb()
&& isOptionSet(options, 'dbFrom')
&& isOptionSet(options, 'dbTo')
&& !isOptionSet(options, 'db')) {
command += ' --nsFrom ' + options.dbFrom + '.*' + ' --nsTo ' + options.dbTo + '.*'
if (isRestore &&
!isLegacyRestoreDb() &&
isOptionSet(options, 'dbFrom') &&
isOptionSet(options, 'dbTo') &&
!isOptionSet(options, 'db')) {
command += ' --nsFrom ' + options.dbFrom + '.*' + ' --nsTo ' + options.dbTo + '.*';
command += ' --nsInclude ' + options.dbFrom + '.*';
}
if (isBooleanOptionSet(options, 'ssl')) {
command += ' --ssl';
Expand Down
5 changes: 4 additions & 1 deletion tests/mongo-wrapper-unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ describe("🧪🧩 MTWrapper unit tests", function () {

const command = wrapper.commandConnectFromOptions(mtOptions, '--beginning', true);

command.should.be.eql("--beginning --host 127.0.0.1 --port 17017 --username myUser --password myPass --authenticationDatabase admin --nsFrom mySourceDbForTest.* --nsTo myTargetDbForTest.*");
command.should.be.eql("--beginning --host 127.0.0.1 --port 17017 --username myUser --password myPass " +
"--authenticationDatabase admin " +
"--nsFrom mySourceDbForTest.* --nsTo myTargetDbForTest.* " +
"--nsInclude mySourceDbForTest.*");
});

it("🧪 should wrap restore commandConnectFromOptions uri ssl", async function () {
Expand Down