test on nested search

This commit is contained in:
mr 2024-07-30 08:59:31 +02:00
parent 5ab011844d
commit 4730d5b4d4

View File

@ -253,7 +253,10 @@ func (m *MongoDB) Search(search string, filter []string, collection_name string)
if cursor, err := targetDBCollection.Find( if cursor, err := targetDBCollection.Find(
MngoCtx, 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, opts,
); err != nil { ); err != nil {
fmt.Println(0, bson.M{"$or": list}) fmt.Println(0, bson.M{"$or": list})