@@ -23,7 +23,7 @@ import { CosmosAccountResourceItemBase } from '../CosmosAccountResourceItemBase'
23
23
import { type MongoAccountModel } from './MongoAccountModel' ;
24
24
25
25
/**
26
- * This implementation relies on information from the CosmosAccountModel , i.e.
26
+ * This implementation relies on information from the MongoAccountModel , i.e.
27
27
* will only behave as expected when used in the context of an Azure Subscription.
28
28
*/
29
29
export class MongoAccountResourceItem extends CosmosAccountResourceItemBase {
@@ -122,8 +122,7 @@ export class MongoAccountResourceItem extends CosmosAccountResourceItemBase {
122
122
throw new Error ( 'Failed to connect.' ) ;
123
123
}
124
124
125
- // TODO: add support for single databases via connection string.
126
- // move it to monogoclustersclient
125
+ // TODO: add support for single databases via connection string. move it to monogoclustersclient
127
126
//
128
127
// const databaseInConnectionString = getDatabaseNameFromConnectionString(this.account.connectionString);
129
128
// if (databaseInConnectionString && !this.isEmulator) {
@@ -137,25 +136,20 @@ export class MongoAccountResourceItem extends CosmosAccountResourceItemBase {
137
136
// ];
138
137
// }
139
138
140
- // https://mongodb.github.io/node-mongodb-native/3.1/api/index.html
141
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
142
139
const databases = await mongoClient . listDatabases ( ) ;
143
140
144
- return databases
145
- . filter (
146
- ( databaseInfo ) =>
147
- ! ( databaseInfo . name && databaseInfo . name . toLowerCase ( ) === 'admin' && databaseInfo . empty ) ,
148
- ) // Filter out the 'admin' database if it's empty
149
- . map ( ( database ) => {
150
- const clusterInfo = this . account as MongoClusterModel ;
151
- // eslint-disable-next-line no-unused-vars
152
- const databaseInfo : DatabaseItemModel = {
153
- name : database . name ,
154
- empty : database . empty ,
155
- } ;
156
-
157
- return new DatabaseItem ( clusterInfo , databaseInfo ) ;
158
- } ) ;
141
+ return databases . map ( ( database ) => {
142
+ const clusterInfo = this . account as MongoClusterModel ;
143
+ clusterInfo . dbExperience = this . experience ;
144
+
145
+ // eslint-disable-next-line no-unused-vars
146
+ const databaseInfo : DatabaseItemModel = {
147
+ name : database . name ,
148
+ empty : database . empty ,
149
+ } ;
150
+
151
+ return new DatabaseItem ( clusterInfo , databaseInfo ) ;
152
+ } ) ;
159
153
160
154
// } catch (error) {
161
155
// const message = parseError(error).message;
0 commit comments