diff options
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/libs/defragmentation_util.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/jstests/sharding/libs/defragmentation_util.js b/jstests/sharding/libs/defragmentation_util.js index b62276f71cd..5ef9e1d2c96 100644 --- a/jstests/sharding/libs/defragmentation_util.js +++ b/jstests/sharding/libs/defragmentation_util.js @@ -94,7 +94,10 @@ var defragmentationUtil = (function() { const storageStats = coll.aggregate(pipeline).toArray(); let avgObjSizeByShard = {}; storageStats.forEach((storageStat) => { - avgObjSizeByShard[storageStat['shard']] = storageStat['storageStats']['avgObjSize']; + avgObjSizeByShard[storageStat['shard']] = + typeof (storageStat['storageStats']['avgObjSize']) === "undefined" + ? 0 + : storageStat['storageStats']['avgObjSize']; }); let checkForOversizedChunk = function( coll, chunk, shardKey, avgObjSize, oversizedChunkThreshold) { |