Better exception handling with mongodb