See https://mongodb.slack.com/archives/CUKTSEB6J/p1611763429004100?thread_ts=1611762413.002900&cid=CUKTSEB6J – I would guess that this refers to https://github.com/mongodb-js/mongosh/blob/fb80fdea897dc48766c80058ddfae203f0e71f0b/packages/shell-api/src/collection.ts#L1395, result.shards can be a non-iterable even though result.sharded is true?
https://docs.mongodb.com/manual/reference/command/collStats/ doesn’t mention either property, but they are present in sharded setups, so I’m not sure whether this is a server bug or purely a shell problem.