我能够通过
$and单独构造零件来实现这一目标-
var AndQuery []map[string]interface{}for i := 0; i < len(body.Properties); i++ { log.Println(body.Properties[i]) currentCondition := bson.M{"properties": bson.M{"$elemMatch": bson.M{"propertyName": body.Properties[i].PropertyName, "propertyValue": body.Properties[i].PropertyValue}}} AndQuery = append(AndQuery, currentCondition)}然后我的查询看起来像-
c.Find(bson.M{"brandId": body.BrandID, "category": body.Category, "$and": AndQuery})


