tianxiaoliang commented on a change in pull request #181:
URL: https://github.com/apache/servicecomb-kie/pull/181#discussion_r618390796



##########
File path: server/service/mongo/kv/kv_dao.go
##########
@@ -123,8 +123,14 @@ func findKV(ctx context.Context, domain string, project 
string, opts service.Fin
        filter := bson.M{"domain": domain, "project": project}
        if opts.Key != "" {
                filter["key"] = opts.Key
-               if strings.HasPrefix(opts.Key, "beginWith") {
-                       filter["key"] = bson.M{"$regex": getValue(opts.Key), 
"$options": "$i"}
+               switch {
+               case strings.HasPrefix(opts.Key, "beginWith("):
+                       value := strings.ReplaceAll(getValue(opts.Key), ".", 
"\\.")
+                       filter["key"] = bson.M{"$regex": value, "$options": 
"$i"}
+               case strings.HasPrefix(opts.Key, "match("):

Review comment:
       match改为wildcard是否更加合理




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to