简体   繁体   English

如何在 Redash Mongo Json Query 中使用正则表达式

[英]How to Use regular expression in Redash Mongo Json Query

I have MongoDB as Data source.我有 MongoDB 作为数据源。 I want to query in redash which will be the equivalent following:-我想在 redash 中查询,这将等同于以下内容:-

db.collection.find({“templateId”:/XYZ$/})

This query return all data from the collection where key templateId end with string XYZ.此查询返回集合中的所有数据,其中键templateId以字符串 XYZ 结尾。 How can I use the same in redash JSON?如何在 redash JSON 中使用相同的内容?

Also please help in using $exist in Redash.也请帮助在 Redash 中使用 $exist。

Got here from googling the same question.通过谷歌搜索同样的问题来到这里。

It seems to me that next pipeline step works:在我看来,下一个管道步骤有效:

{"$match": {"templateId": {"$regex": "XYZ$"}}}

I use this example with Redash.我在 Redash 中使用了这个例子。

{
    "collection": "Users",
    "query": {
        "Phone": {
            "$regex": "1234$"
        }
    }
}






声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM