Mongo DB Query using Like

I have MongoDB as Data source.I want to query in redash which will be equivalent following:-

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

This query return all data from collection where key templateid end with string XYZ.How can i use same in redash JSON.

Also please help in using $exist in Redash.

Sorry for the late reply. You can do both of these in Redash. Here’s a quick example using a collection called “comments”.

{
    "collection": "comments",
    "query": {
        "name": {"$regex": "XYZ$" },
        "callback_url": { "$exists": false }
    }
}

The pattern matching shorthand using a forward slash / is a shortcut to using the $regex query operation in Mongo. In Redash, however, you have to supply this explicitly because all queries must evaluate as valid JSON (values wrapped in quotation marks). The expression /XYZ$/ isn’t a valid JSON key (thought it is valid Javascript).