my code here
var c1 Category
var setElements bson.D
if len(c.CategoryLargeType) > 0 {
setElements = append(setElements, bson.E{Key: "category_large_type", Value: c.CategoryLargeType})
}
if len(c.CategoryMiddleType) > 0 {
setElements = append(setElements, bson.E{Key: "category_middle_type", Value: c.CategoryMiddleType})
}
if len(c.CategorySmallType) > 0 {
setElements = append(setElements, bson.E{Key: "category_small_type", Value: c.CategorySmallType})
}
setMap := bson.D{
{Key: "$in", Value: setElements},
}
fmt.Println(setMap)
err := categoryCollection.FindOne(ctx, setMap).Decode(&c1)
fmt.Println(c1)
fmt.Println(err)
if err != nil {
return http.StatusInternalServerError, Response{Status: http.StatusInternalServerError, Mssage: "데이터 변환에 실패하였습니다.", Result: ""}
}
return http.StatusOK, Response{Status: http.StatusInternalServerError, Mssage: "이미 저장된 데이터가 존재합니다.", Result: c1}
example) select * from TEST where id ="" AND title="" AND desc =""
how to use example for golang mongodb Find