When venues (bars, clubs, supermarkets) scan your ID, they are scanning the barcode on the back.
For details of what is stored on that barcode:
https://www.aamva.org/getmedia/99ac7057-0f4d-4461-b0a2-3a553...
What's on passports and some identity docs:
https://en.wikipedia.org/wiki/Machine-readable_passport
There have been many cases where clubs stored the documents scanned which were then hacked. Or where club/bar staff used the scanned/stored documents to stalk attractive women.
Sample:
https://www.theverge.com/tech/947157/passports-data-breach-c...