def _get_samples_bytes(self):
        """Computes the total size of the sample documents in the collection."""

        # Impl note: We *could* do group directly without projecting $bsonSize
        #   first, however we found in Mongo 5.2 a new execution engine
        #   (Slot Based Execution) optimizes this away and incorrectly sums
        #   the full document size, thus ignoring selected fields. A ticket
        #   has been opened to resolve this bug.
        #   https://jira.mongodb.org/browse/SERVER-75267
        #   But until then we must do this in 2 stages (project-size, group-sum)
        #   rather than 1 (group-sum-size)
        pipeline = [
            {"$project": {"size": {"$bsonSize": "$$ROOT"}}},
            {
                "$group": {
                    "_id": None,
                    "size_bytes": {"$sum": "$size"},
                }
            },
        ]

        results = self._aggregate(pipeline=pipeline)

        try:
            return next(iter(results))["size_bytes"]
        except:
            return 0
Computes the total size of the sample documents in the collection.
fiftyone/core/collections.py