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.