File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
docs/integrations/data-ingestion/clickpipes/mongodb Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -10,17 +10,19 @@ title: 'ClickPipes for MongoDB FAQ'
1010
1111### Can I query for individual fields in the JSON datatype? {#can-i-query-for-individual-fields-in-the-json-datatype}
1212
13- Yes, ClickHouse provides powerful JSON querying capabilities.
14-
15- 1 . ** Dot Notation** : Direct field access
13+ You can use ** dot notation** for direct field access:
1614``` sql
1715SELECT doc .customer .name as name FROM your_table;
1816```
19-
20- 2 . ** Nested Objects** : Use the ` ^ ` operator for sub-objects
17+ For nested object fields, use the ` ^ ` operator:
2118``` sql
2219SELECT doc.^address .city AS city FROM your_table;
2320```
21+ For aggregations, cast the field to the appropriate type with the ` CAST ` function or ` :: ` syntax:
22+ ``` sql
23+ SELECT sum (doc .shipping .cost::Float32) AS total_shipping_cost FROM t1;
24+ ```
25+ To learn more about working with JSON, see our [ Working with JSON guide] ( ./quickstart ) .
2426
2527### How do I flatten the nested MongoDB documents in ClickHouse? {#how-do-i-flatten-the-nested-mongodb-documents-in-clickhouse}
2628
You can’t perform that action at this time.
0 commit comments