Escaping *

This commit is contained in:
rbarrabe
2016-09-15 10:01:52 +02:00
committed by GitHub
parent 80540bbfe3
commit e93e65d28d

View File

@@ -679,7 +679,7 @@ func (ms *MongoStorage) SetRatingProfile(rp *RatingProfile, transactionID string
func (ms *MongoStorage) RemoveRatingProfile(key, transactionID string) error {
session, col := ms.conn(colRpf)
defer session.Close()
iter := col.Find(bson.M{"id": bson.RegEx{Pattern: key + ".*", Options: ""}}).Select(bson.M{"id": 1}).Iter()
iter := col.Find(bson.M{"id": bson.RegEx{Pattern: strings.Replace(key,"*","\\*",-1) + ".*", Options: ""}}).Select(bson.M{"id": 1}).Iter()
var result struct{ Id string }
for iter.Next(&result) {
if err := col.Remove(bson.M{"id": result.Id}); err != nil {