code added to post data to mongodb