Skip to content

Commit 83f6b7e

Browse files
authored
fix(shell-api): default to empty list for listCollections() (#557)
Based on seeing this output in CI, it seems reasonable to assume that `listCollections().toArray()` can return `undefined`, even if the TypeScript definitions don’t indicate that. [2021/01/18 10:13:20.959] (node:18714) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined [2021/01/18 10:13:20.959] at Proxy._getCollectionNames (/data/mci/63c1249309c29dbf51f08a235fcdfa5e/src/packages/shell-api/src/database.ts:144:41)
1 parent 39e6dfb commit 83f6b7e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/shell-api/src/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default class Database extends ShellApiClass {
136136
this._name,
137137
filter,
138138
{ ...this._baseOptions, ...options }
139-
);
139+
) || [];
140140
}
141141

142142
async _getCollectionNames(): Promise<string[]> {

0 commit comments

Comments
 (0)