From 4730d5b4d4011b28321fbc16460c368ac02f4f86 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 30 Jul 2024 08:59:31 +0200 Subject: [PATCH] test on nested search --- dbs/mongo/mongo.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dbs/mongo/mongo.go b/dbs/mongo/mongo.go index 5a1f2e5..ce37b7e 100644 --- a/dbs/mongo/mongo.go +++ b/dbs/mongo/mongo.go @@ -253,7 +253,10 @@ func (m *MongoDB) Search(search string, filter []string, collection_name string) if cursor, err := targetDBCollection.Find( MngoCtx, - bson.M{"name": bson.M{"$regex": search, "$options": "i"}}, + bson.M{"$or": []bson.M{ + {"abstractresource.abstractobject.name": bson.M{"$regex": search, "$options": "i"}}, + {"abstractresource.description": bson.M{"$regex": search, "$options": "i"}}, + }}, opts, ); err != nil { fmt.Println(0, bson.M{"$or": list})