Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

fix(api): support standalone MongoDB contacts

Acho Arnold Ewin85c2167385d8
diff --git a/api/pkg/repositories/mongo_contact_repository.go b/api/pkg/repositories/mongo_contact_repository.go
index 6cca028c..23c78357 100644
--- a/api/pkg/repositories/mongo_contact_repository.go
+++ b/api/pkg/repositories/mongo_contact_repository.go
@@ -50,16 +50,7 @@ func (repository *mongoContactRepository) Store(ctx context.Context, contacts []
documents[index] = contact
}
- session, err := repository.collection.Database().Client().StartSession()
- if err != nil {
- return repository.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "cannot start transaction to store [%d] contacts", len(contacts)))
- }
- defer session.EndSession(ctx)
-
- _, err = session.WithTransaction(ctx, func(transactionCtx context.Context) (any, error) {
- return repository.collection.InsertMany(transactionCtx, documents)
- })
- if err != nil {
+ if _, err := repository.collection.InsertMany(ctx, documents); err != nil {
return repository.tracer.WrapErrorSpan(span, stacktrace.Propagatef(err, "cannot store [%d] contacts", len(contacts)))
}