func (p *UserService) createAndInsertUser(userName string, password string, email string, tenanId string, roleId string, company string) (userId string, err error) { // var jsondocument interface{} currentUser, erro := p.getAllUserByName(userName) if erro != nil { logrus.Error("get all user by username err is %v", erro) return "", erro } if len(currentUser) != 0 { logrus.Infoln("user already exist! username:"******"create user error %v", err) return } userId = user.ObjectId.Hex() return }