File tree 1 file changed +4
-9
lines changed
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -114,14 +114,14 @@ public function getTables()
114
114
$ db = $ this ->connection ->getMongoDB ();
115
115
$ collections = [];
116
116
117
- foreach ($ db ->listCollections () as $ collectionInfos ) {
118
- $ stats = $ db ->selectCollection ($ collectionInfos -> getName () )->aggregate ([
117
+ foreach ($ db ->listCollectioNames () as $ collectionName ) {
118
+ $ stats = $ db ->selectCollection ($ collectionName )->aggregate ([
119
119
['$collStats ' => ['storageStats ' => ['scale ' => 1 ]]],
120
120
['$project ' => ['storageStats.totalSize ' => 1 ]],
121
121
])->toArray ();
122
122
123
123
$ collections [] = [
124
- 'name ' => $ collectionInfos -> getName () ,
124
+ 'name ' => $ collectionName ,
125
125
'schema ' => null ,
126
126
'size ' => $ stats [0 ]?->storageStats?->totalSize ?? null ,
127
127
'comment ' => null ,
@@ -139,12 +139,7 @@ public function getTables()
139
139
140
140
public function getTableListing ()
141
141
{
142
- $ db = $ this ->connection ->getMongoDB ();
143
- $ collections = [];
144
-
145
- foreach ($ db ->listCollections () as $ collectionInfos ) {
146
- $ collections [] = $ collectionInfos ->getName ();
147
- }
142
+ $ collections = iterator_to_array ($ this ->connection ->getMongoDB ()->listCollectionNames ());
148
143
149
144
sort ($ collections );
150
145
You can’t perform that action at this time.
0 commit comments