diff --git a/dbs/mongo/mongo.go b/dbs/mongo/mongo.go index 7e0c080..afe42e4 100644 --- a/dbs/mongo/mongo.go +++ b/dbs/mongo/mongo.go @@ -279,10 +279,11 @@ func (m *MongoDB) Search(filters *dbs.Filters, collection_name string) (*mongo.C } if len(orList) > 0 && len(andList) == 0 { f = bson.D{{"$or", orList}} - } else if len(orList) == 0 && len(andList) > 0 { + } else { + if len(orList) > 0 { + andList = append(andList, bson.M{"$or": orList}) + } f = bson.D{{"$and", andList}} - } else if len(orList) > 0 && len(andList) > 0 { - f = bson.D{{"$and", andList}, {"$or", orList}} } }