From 0e96b5c01a4fe6b1f5efce966279d0571f0acd4c Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 30 Jul 2024 08:39:28 +0200 Subject: [PATCH] logs on search --- dbs/mongo/mongo.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dbs/mongo/mongo.go b/dbs/mongo/mongo.go index 8b4b672..5a1f2e5 100644 --- a/dbs/mongo/mongo.go +++ b/dbs/mongo/mongo.go @@ -207,7 +207,7 @@ func (m *MongoDB) StoreOne(obj interface{}, id string, collection_name string) ( bson.Unmarshal(b, &doc) doc["_id"] = id targetDBCollection := CollectionMap[collection_name] - fmt.Println("DB", targetDBCollection) + fmt.Println("DB", collection_name, targetDBCollection, CollectionMap) MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second) defer cancel() @@ -253,10 +253,7 @@ func (m *MongoDB) Search(search string, filter []string, collection_name string) if cursor, err := targetDBCollection.Find( MngoCtx, - bson.M{"$or": []bson.M{ - {"name": bson.M{"$regex": search, "$options": "i"}}, - {"description": bson.M{"$regex": search, "$options": "i"}}, - }}, + bson.M{"name": bson.M{"$regex": search, "$options": "i"}}, opts, ); err != nil { fmt.Println(0, bson.M{"$or": list})