Skip to content

Commit

Permalink
问题:mongodb表名带-和.符号无法申请上线,原因:\w只匹配[a-zA-Z0-9_],修正:(\w*) -> ([\w\.-]+) (#…
Browse files Browse the repository at this point in the history
…1372)

Co-authored-by: 蒋宏飞 <jianghongfei@cnstrong.cn>
  • Loading branch information
CrusM and 蒋宏飞 committed Feb 10, 2022
1 parent 0abcd43 commit 17fad34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sql/engines/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def execute_check(self, db_name=None, sql=''):
"remove", "replaceOne", "renameCollection", "update", "updateOne",
"updateMany", "renameCollection"]
pattern = re.compile(
r'''^db\.createCollection\(([\s\S]*)\)$|^db\.(\w+)\.(?:[A-Za-z]+)(?:\([\s\S]*\)$)|^db\.getCollection\((?:\s*)(?:'|")([\w-]*)('|")(\s*)\)\.([A-Za-z]+)(\([\s\S]*\)$)''')
r'''^db\.createCollection\(([\s\S]*)\)$|^db\.([\w\.-]+)\.(?:[A-Za-z]+)(?:\([\s\S]*\)$)|^db\.getCollection\((?:\s*)(?:'|")([\w-]*)('|")(\s*)\)\.([A-Za-z]+)(\([\s\S]*\)$)''')
m = pattern.match(check_sql)
if m is not None and (re.search(re.compile(r'}(?:\s*){'), check_sql) is None) and check_sql.count(
'{') == check_sql.count('}') and check_sql.count('(') == check_sql.count(')'):
Expand Down

0 comments on commit 17fad34

Please sign in to comment.