def _get_per_sample_bytes(self):
        """Returns a dictionary mapping sample IDs to document sizes (in bytes)
        for each sample in the collection.
        """
        pipeline = [{"$project": {"size_bytes": {"$bsonSize": "$$ROOT"}}}]

        results = self._aggregate(pipeline=pipeline)
        return {str(r["_id"]): r["size_bytes"] for r in results}
Returns a dictionary mapping sample IDs to document sizes (in bytes)
        for each sample in the collection.
        
fiftyone/core/collections.py