// UserExists allows checking if a user exists by its email
UserExists allows checking if a user exists by its email
// UserExists allows checking if a user exists by its email
func (db *Mngo) UserExists(email string) (bool, *models.User, error) {
	c := db.database.Collection(models.UsersCollection)
	user := &models.User{}
	err := c.FindOne(db.context, bson.M{"email": email}).Decode(&user)
	if err != nil {
		return false, nil, helpers.NewError(http.StatusNotFound, "user_not_found", "User not found", err)
	}
	return true, user, err
}
func ( db * Mngo ) UserExists ( email string ) ( bool , * models . User , error ) { c := db . database . Collection ( models . UsersCollection ) user := & models . User { } err := c . FindOne ( db . context , bson . M { " " : email } ) . Decode ( & user ) if err != nil { return false , nil , helpers . NewError ( http . StatusNotFound , " " , " " , err ) } return true , user , err }
UserExists allows checking if a user exists by its email
UserExists allows checking if a user exists by its email