writes users to mongodb