我需要通过用户ID进行查询,但是我认为查询期间很混乱。我尝试了以下3个查询。括号和引号给我一个错误,第一个不产生错误,但没有结果。
SELECT * FROM c WHERE c.document.BotAccessors.BotState.Profile.UserId = "5351ec9f-46fb-449a-b6f5-1ea07e683015"
SELECT * FROM c WHERE c.document.[BotAccessors.BotState].Profile.UserId = "5351ec9f-46fb-449a-b6f5-1ea07e683015"
SELECT * FROM c WHERE c.document."BotAccessors.BotState".Profile.UserId = "5351ec9f-46fb-449a-b6f5-1ea07e683015"
{
"document": {
"BotAccessors.BotState": {
"Version": 4,
"ConversationState": 0,
"FirstMessageDateTime": "2020-03-04T13:19:20.7657389Z",
"FirstMessage": null,
"LastSeenDateTimeTicks": 637189282249482900,
"Profile": {
"UserId": "5351ec9f-46fb-449a-b6f5-1ea07e683015",
}
}
},
"_etag": "\"0300fbab-0000-0700-0000-5e5fb85e0000\"",
"_rid": "4zYrANO8oXoBAAAAAAAAAA==",
"_self": "dbs/4zYrAA==/colls/4zYrANO8oXo=/docs/4zYrANO8oXoBAAAAAAAAAA==/",
"_attachments": "attachments/",
"_ts": 1583331422
}
答案 0 :(得分:1)
对于非a-zA-Z0-9字符的属性名称,您需要使用带引号的方括号。这是一个示例:
SELECT * FROM c WHERE c["document"]["BotAccessors.BotState"]["Profile"]["UserId"] = "5351ec9f-46fb-449a-b6f5-1ea07e683015"