missing context on search

This commit is contained in:
mr 2024-07-29 15:22:14 +02:00
parent 8c3b92143e
commit d77a403150

View File

@ -249,6 +249,9 @@ func (m *MongoDB) Search(search string, filter []string, collection_name string)
for _, k := range filter {
list = append(list, bson.M{k: bson.M{"$regex": search}})
}
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if cursor, err := targetDBCollection.Find(
MngoCtx, bson.M{"$or": list},
opts,