From b801be6aca27649202989af78bd39f7571b2b7ce Mon Sep 17 00:00:00 2001 From: mountain Date: Wed, 23 Jul 2025 12:21:00 +0900 Subject: [PATCH] =?UTF-8?q?string=EC=9D=84=20objectid=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=ED=99=98=ED=95=98=EB=8A=94=20=EC=BC=80=EC=9D=B4=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index b3f4ef6..c6987c2 100644 --- a/server.go +++ b/server.go @@ -354,9 +354,14 @@ func ConvertInterface(from interface{}, toType reflect.Type) reflect.Value { case reflect.Bool: val, _ := strconv.ParseBool(from.(string)) return reflect.ValueOf(val) + + case reflect.String: + if toType == reflect.TypeOf(primitive.ObjectID{}) { + objid, _ := primitive.ObjectIDFromHex(from.(string)) + return reflect.ValueOf(objid) + } } - logger.Println("ConvertInterface :", fromtype.String(), toType.String(), toType.Kind().String()) return fromrv.Convert(toType) }