You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifies that the JSON value should be retrieved instead of the complete JSON object. This, unlike `<property_list>` does not wrap the projected value in an object.
47
-
47
+
48
48
-`DISTINCT`
49
49
50
50
Specifies that duplicates of projected properties should be removed.
@@ -93,122 +93,6 @@ The results are:
93
93
}]
94
94
```
95
95
96
-
### Quoted property accessor
97
-
You can access properties using the quoted property operator []. For example, `SELECT c.grade` and `SELECT c["grade"]` are equivalent. This syntax is useful to escape a property that contains spaces, special characters, or has the same name as a SQL keyword or reserved word.
98
-
99
-
```sql
100
-
SELECT f["lastName"]
101
-
FROM Families f
102
-
WHERE f["id"] ="AndersenFamily"
103
-
```
104
-
105
-
### Nested properties
106
-
107
-
The following example projects two nested properties, `f.address.state` and `f.address.city`.
108
-
109
-
```sql
110
-
SELECTf.address.state, f.address.city
111
-
FROM Families f
112
-
WHEREf.id="AndersenFamily"
113
-
```
114
-
115
-
The results are:
116
-
117
-
```json
118
-
[{
119
-
"state": "WA",
120
-
"city": "Seattle"
121
-
}]
122
-
```
123
-
### JSON expressions
124
-
125
-
Projection also supports JSON expressions, as shown in the following example:
In the preceding example, the SELECT clause needs to create a JSON object, and since the sample provides no key, the clause uses the implicit argument variable name `$1`. The following query returns two implicit argument variables: `$1` and `$2`.
If your data contains properties with the same names as reserved keywords such as "order" or "Group" then the queries against these documents will result in syntax errors. You should explicitly include the property in `[]` character to run the query successfully.
170
-
171
-
For example, here's a document with a property named `order` and a property `price($)` that contains special characters:
172
-
173
-
```json
174
-
{
175
-
"id": "AndersenFamily",
176
-
"order": [
177
-
{
178
-
"orderId": "12345",
179
-
"productId": "A17849",
180
-
"price($)": 59.33
181
-
}
182
-
],
183
-
"creationDate": 1431620472,
184
-
"isRegistered": true
185
-
}
186
-
```
187
-
188
-
If you run a queries that includes the `order` property or `price($)` property, you will receive a syntax error.
0 commit comments