It is possible to retrieve an array of objects as if it were a separate table. Take the following
JSON structure from the restaurants collection for example:
{
"restaurantid" : "30075445",
"address" : {
"building" : "1007",
"coord" : "-73.856077, 40.848447",
"street" : "Morris Park Ave",
"zipcode" : "10462"
},
"borough" : "Bronx",
"cuisine" : "Bakery",
"grades" : "{
"date" : 1393804800000,
"grade" : "A",
"score" : 2
}, {
"date" : 1378857600000,
"grade" : "A",
"score" : 6
}, {
"date" : 1358985600000,
"grade" : "A",
"score" : 10
}, {
"date" : 1322006400000,
"grade" : "A",
"score" : 9
}, {
"date" : 1299715200000,
"grade" : "B",
"score" : 14
}",
"name" : "Morris Park Bake Shop",
}
Vertical flattening will allow you to retrieve the grades array as a separate table:
SELECT * FROM "restaurants.grades"
This query returns the following data set:
| date | grade | score | restaurantid | _index |
| 1393804800000 | A | 2 | 30075445 | 1 |
| 1378857600000 | A | 6 | 30075445 | 2 |
| 1358985600000 | A | 10 | 30075445 | 3 |
You may also want to include information from the base restaurants table. You can do this with a join.
SELECT restaurants.name, "restaurants.grades".* FROM "restaurants" JOIN "restaurants.grades" ON restaurants.restaurantid = "restaurants.grades".restaurantid WHERE restaurants.restaurantid = 30075445 AND "restaurants.grades".restaurantid = 30075445
This query returns the following data set:
| name | restaurantid | date | grade | score | _index |
| Morris Park Bake Shop | 30075445 | 1393804800000 | A | 2 | 1 |
| Morris Park Bake Shop | 30075445 | 1378857600000 | A | 6 | 2 |
| Morris Park Bake Shop | 30075445 | 1358985600000 | A | 10 | 3 |
| Morris Park Bake Shop | 30075445 | 1322006400000 | A | 9 | 4 |
| Morris Park Bake Shop | 30075445 | 1299715200000 | B | 14 | 5 |