@@ -1083,49 +1083,52 @@ class DataServiceImpl extends WithLogContext implements DataService {
10831083 try {
10841084 const coll = this . _collection ( ns , 'CRUD' ) ;
10851085 const collStats = await coll
1086- . aggregate ( [
1087- { $collStats : { storageStats : { } } } ,
1088- {
1089- $group : {
1090- _id : null ,
1091- capped : { $first : '$storageStats.capped' } ,
1092- count : { $sum : '$storageStats.count' } ,
1093- size : { $sum : { $toDouble : '$storageStats.size' } } ,
1094- storageSize : {
1095- $sum : { $toDouble : '$storageStats.storageSize' } ,
1096- } ,
1097- totalIndexSize : {
1098- $sum : { $toDouble : '$storageStats.totalIndexSize' } ,
1099- } ,
1100- freeStorageSize : {
1101- $sum : { $toDouble : '$storageStats.freeStorageSize' } ,
1102- } ,
1103- unscaledCollSize : {
1104- $sum : {
1105- $multiply : [
1106- { $toDouble : '$storageStats.avgObjSize' } ,
1107- { $toDouble : '$storageStats.count' } ,
1108- ] ,
1086+ . aggregate (
1087+ [
1088+ { $collStats : { storageStats : { } } } ,
1089+ {
1090+ $group : {
1091+ _id : null ,
1092+ capped : { $first : '$storageStats.capped' } ,
1093+ count : { $sum : '$storageStats.count' } ,
1094+ size : { $sum : { $toDouble : '$storageStats.size' } } ,
1095+ storageSize : {
1096+ $sum : { $toDouble : '$storageStats.storageSize' } ,
1097+ } ,
1098+ totalIndexSize : {
1099+ $sum : { $toDouble : '$storageStats.totalIndexSize' } ,
11091100 } ,
1101+ freeStorageSize : {
1102+ $sum : { $toDouble : '$storageStats.freeStorageSize' } ,
1103+ } ,
1104+ unscaledCollSize : {
1105+ $sum : {
1106+ $multiply : [
1107+ { $toDouble : '$storageStats.avgObjSize' } ,
1108+ { $toDouble : '$storageStats.count' } ,
1109+ ] ,
1110+ } ,
1111+ } ,
1112+ nindexes : { $max : '$storageStats.nindexes' } ,
11101113 } ,
1111- nindexes : { $max : '$storageStats.nindexes' } ,
11121114 } ,
1113- } ,
1114- {
1115- $addFields : {
1116- // `avgObjSize` is the average of per-shard `avgObjSize` weighted by `count`
1117- avgObjSize : {
1118- $cond : {
1119- if : { $ne : [ '$count' , 0 ] } ,
1120- then : {
1121- $divide : [ '$unscaledCollSize' , { $toDouble : '$count' } ] ,
1115+ {
1116+ $addFields : {
1117+ // `avgObjSize` is the average of per-shard `avgObjSize` weighted by `count`
1118+ avgObjSize : {
1119+ $cond : {
1120+ if : { $ne : [ '$count' , 0 ] } ,
1121+ then : {
1122+ $divide : [ '$unscaledCollSize' , { $toDouble : '$count' } ] ,
1123+ } ,
1124+ else : 0 ,
11221125 } ,
1123- else : 0 ,
11241126 } ,
11251127 } ,
11261128 } ,
1127- } ,
1128- ] )
1129+ ] ,
1130+ { enableUtf8Validation : false }
1131+ )
11291132 . toArray ( ) ;
11301133
11311134 if ( ! collStats || collStats [ 0 ] === undefined ) {
@@ -1226,7 +1229,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
12261229 try {
12271230 const cursor = this . _database ( databaseName , 'CRUD' ) . listCollections (
12281231 filter ,
1229- { nameOnly }
1232+ { nameOnly, enableUtf8Validation : false }
12301233 ) ;
12311234 // Iterate instead of using .toArray() so we can emit
12321235 // collection info update events as they come in.
0 commit comments