Array index projection

To project an element at a specific index in an array. You can specify the index of the element using dot notation. It is important to avoid using numbers as attribute names for arrays in your documents as this can possibly cause unexepcted behaviours when querying the array by index.

{ "_id" : ObjectId("4d2d8deff4e6c1d71fc29a07"), "user_id" : "714638ba-2e08-2168-2b99-00002f3d43c0", "events" : [ { "handled" : 1, "profile" : 10, "data" : { } } { "handled" : 1, "profile" : 10, "data" : { } } ... ] } From the above document, project the first document in the events array as in. { "_id" : ObjectId("4d2d8deff4e6c1d71fc29a07"), "first_event" : [ { "handled" : 1, "profile" : 10, "data" : { } } ] } SELECT _id, events.0 as first_event FROM devices WHERE user_id = '714638ba-2e08-2168-2b99-00002f3d43c0'