Skip to content

Commit b0244ae

Browse files
authored
fix(shell-api): do not assume partioned field in config.databases to exist MONGOSH-1438 (#1448)
1 parent dac2db3 commit b0244ae

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/shell-api/src/helpers.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,6 @@ export async function getPrintableShardStatus(configDB: Database, verbose: boole
397397
]);
398398
result.balancer = balancerRes;
399399

400-
const dbRes: any[] = [];
401-
result.databases = dbRes;
402-
403400
const databases = await (await configDB.getCollection('databases').find()).sort({ name: 1 }).toArray();
404401

405402
// Special case the config db, since it doesn't have a record in config.databases.

packages/shell-api/src/shard.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ describe('Shard', () => {
16581658
await dbSh.dropDatabase();
16591659
});
16601660

1661-
it('the list includes not partitioned databases', async() => {
1661+
it('the list includes databases that were never explicitly sharded', async() => {
16621662
await dbRegular.getCollection(collRegularName).insertOne({ foo: 'bar', key: 99 });
16631663

16641664
const collSh = dbSh.getCollection(collShName);
@@ -1670,10 +1670,11 @@ describe('Shard', () => {
16701670
const result = await sh.status();
16711671

16721672
const databasesDbItem = result.value.databases.find((item) => (item.database._id === 'db'));
1673-
expect(databasesDbItem.database.partitioned).to.equal(false);
1673+
// Cannot get strict guarantees about the value of this field since SERVER-63983
1674+
expect(databasesDbItem.database.partitioned).to.be.oneOf([false, undefined]);
16741675
const databasesDbShItem = result.value.databases.find((item) => (item.database._id === 'dbSh'));
1675-
// Cannot get strict guarantees about the value of this field since SERVER-60926
1676-
expect(databasesDbShItem.database.partitioned).to.be.a('boolean');
1676+
// Cannot get strict guarantees about the value of this field since SERVER-60926 and SERVER-63983
1677+
expect(databasesDbShItem.database.partitioned).to.be.oneOf([true, false, undefined]);
16771678
});
16781679
});
16791680
});

0 commit comments

Comments
 (0)