diff --git a/dbs/dbs.go b/dbs/dbs.go index 29d3163..003a771 100644 --- a/dbs/dbs.go +++ b/dbs/dbs.go @@ -3,6 +3,7 @@ package dbs import ( "fmt" "reflect" + "regexp" "runtime/debug" "strings" @@ -239,6 +240,9 @@ func jsonToBsonPaths(t reflect.Type, prefix string) map[string]string { } if ft.Kind() == reflect.Struct { embedPrefix := strings.ToLower(ft.Name()) + re := regexp.MustCompile(`\[[^\]]*\]`) + embedPrefix = re.ReplaceAllString(embedPrefix, "") + embedPrefix = strings.ReplaceAll(embedPrefix, "*", "") if prefix != "" { embedPrefix = prefix + "." + embedPrefix }