diff --git a/dbs/mongo/mongo.go b/dbs/mongo/mongo.go index d8ca398..709ef93 100644 --- a/dbs/mongo/mongo.go +++ b/dbs/mongo/mongo.go @@ -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,