cosmos db sql query with non alphanumeric field name

前端 未结 1 845
独厮守ぢ
独厮守ぢ 2020-11-30 14:55

My data structure in cosmosdb is next

   {
      \"_id\": {
      \"$oid\": \"554f7dc4e4b03c257a33f75c\"
      },
      .................
   }
相关标签:
1条回答
  • 2020-11-30 15:48

    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"]
    
    0 讨论(0)
提交回复
热议问题