writing data into mongoDB