Skip to content

Commit a87230b

Browse files
authored
fix(shell-api): include db name in collection print MONGOSH-927 (#1044)
1 parent 14f1d18 commit a87230b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
collection
1+
admin.collection
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
StringResult: does not exist
1+
StringResult: test.does not exist

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('Collection', () => {
5858
const coll = new Collection(mongo as any, db, 'myCollection');
5959
it('toShellResult', async() => {
6060
expect((await toShellResult(coll)).type).to.equal('Collection');
61-
expect((await toShellResult(coll)).printable).to.equal('myCollection');
61+
expect((await toShellResult(coll)).printable).to.equal('myDB.myCollection');
6262
});
6363
});
6464
});

packages/shell-api/src/collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class Collection extends ShellApiWithMongoClass {
119119
* Internal method to determine what is printed for this class.
120120
*/
121121
[asPrintable](): string {
122-
return this._name;
122+
return `${this._database.getName()}.${this._name}`;
123123
}
124124

125125
/**

0 commit comments

Comments
 (0)