updated code works with my mongodb config