cosmos db sql query with non alphanumeric field name

Solution 1:

To use a special character, like $, you need to use bracket notation:

SELECT c._id FROM c
order by c._id["$oid"]

You can do this with each property in the hierarchy, so the following also works:

SELECT c._id FROM c
order by c["_id"]["$oid"]