Modified Version that uses MongoDB instead of mysql