// GetUsers allows to get all users
GetUsers allows to get all users
// GetUsers allows to get all users
func (db *Mngo) GetUsers(groupID string) ([]*models.User, error) {
	c := db.database.Collection(models.UsersCollection)
	list := []*models.User{}
	var filter bson.M
	if groupID != "" {
		filter = bson.M{"group_id": groupID}
	}
	cur, err := c.Find(context.TODO(), filter)
	if err != nil {
		logrus.Warnln("Error on Finding all the documents", err)
	}
	for cur.Next(context.TODO()) {
		var elem models.User
		err = cur.Decode(&elem)
		if err != nil {
			logrus.Warnln("Error on Decoding the document", err)
		}
		list = append(list, &elem)
	}
	return list, err
}
func ( db * Mngo ) GetUsers ( groupID string ) ( [ ] * models . User , error ) { c := db . database . Collection ( models . UsersCollection ) list := [ ] * models . User { } var filter bson . M if groupID != " " { filter = bson . M { " " : groupID } } cur , err := c . Find ( context . TODO ( ) , filter ) if err != nil { logrus . Warnln ( " " , err ) } for cur . Next ( context . TODO ( ) ) { var elem models . User err = cur . Decode ( & elem ) if err != nil { logrus . Warnln ( " " , err ) } list = append ( list , & elem ) } return list , err }
GetUsers allows to get all users
GetUsers allows to get all users