missing context on search
This commit is contained in:
parent
8c3b92143e
commit
d77a403150
@ -249,6 +249,9 @@ func (m *MongoDB) Search(search string, filter []string, collection_name string)
|
|||||||
for _, k := range filter {
|
for _, k := range filter {
|
||||||
list = append(list, bson.M{k: bson.M{"$regex": search}})
|
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(
|
if cursor, err := targetDBCollection.Find(
|
||||||
MngoCtx, bson.M{"$or": list},
|
MngoCtx, bson.M{"$or": list},
|
||||||
opts,
|
opts,
|
||||||
|
Loading…
Reference in New Issue
Block a user