Implement error logging using mongo