This commit is contained in:
mr 2024-09-23 14:51:41 +02:00
parent 6acbcb6704
commit 50ea0969e6

View File

@ -219,7 +219,7 @@ func (m *MongoDB) UpdateMultiple(set interface{}, filter map[string]interface{},
f = append(f, bson.E{Key: k, Value: v}) f = append(f, bson.E{Key: k, Value: v})
} }
targetDBCollection := CollectionMap[collection_name] targetDBCollection := CollectionMap[collection_name]
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second) MngoCtx, cancel = context.WithTimeout(context.Background(), 50*time.Second)
defer cancel() defer cancel()
res, err := targetDBCollection.UpdateMany(MngoCtx, f, dbs.InputToBson(doc, true)) res, err := targetDBCollection.UpdateMany(MngoCtx, f, dbs.InputToBson(doc, true))
if err != nil { if err != nil {
@ -238,7 +238,7 @@ func (m *MongoDB) UpdateOne(set interface{}, id string, collection_name string)
bson.Unmarshal(b, &doc) bson.Unmarshal(b, &doc)
filter := bson.M{"_id": id} filter := bson.M{"_id": id}
targetDBCollection := CollectionMap[collection_name] targetDBCollection := CollectionMap[collection_name]
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second) MngoCtx, cancel = context.WithTimeout(context.Background(), 50*time.Second)
defer cancel() defer cancel()
_, err := targetDBCollection.UpdateOne(MngoCtx, filter, dbs.InputToBson(doc, true)) _, err := targetDBCollection.UpdateOne(MngoCtx, filter, dbs.InputToBson(doc, true))
if err != nil { if err != nil {