They check your criminal background and mental history with mental institutes, etc....
Correct to a point.
The mental health check is with the MA Dept of Mental Health (or whatever name they now use). Their database "should" flag people committed to an institution under a court order. BUT that check won't find out about the person who voluntarily checks into an institution to help himself with a mental health problem.