diff --git a/server/db/providers/mongodb/provider.go b/server/db/providers/mongodb/provider.go index 7a969a9..fd4a0b2 100644 --- a/server/db/providers/mongodb/provider.go +++ b/server/db/providers/mongodb/provider.go @@ -119,6 +119,15 @@ func NewProvider() (*provider, error) { }, }, options.CreateIndexes()) + mongodb.CreateCollection(ctx, models.Collections.SMSVerificationRequest, options.CreateCollection()) + smsCollection := mongodb.Collection(models.Collections.SMSVerificationRequest, options.Collection()) + smsCollection.Indexes().CreateMany(ctx, []mongo.IndexModel{ + { + Keys: bson.M{"phone_number": 1}, + Options: options.Index().SetUnique(true).SetSparse(true), + }, + }, options.CreateIndexes()) + return &provider{ db: mongodb, }, nil