@kadin
To query nested fields in MongoDB using Presto, you can use the following steps:
1 2 3 4 5 6 7 8 |
{
"_id": "1",
"name": "John",
"address": {
"street": "123 Main St",
"city": "New York"
}
}
|
You can query the nested field "street" in the "address" field like this:
1
|
SELECT name, address['street'] FROM users; |
This query will return the name of the user and the street address from the "address" field.
1
|
SELECT name FROM users WHERE address['city'] = 'New York'; |
This query will return the name of all users who live in the city of "New York".
By following these steps, you can query nested fields in MongoDB using Presto.