persisting data to mongodb