Fixed mongodb connection and mongodb schema

Please do code review!