Below is the mongodb collection sample data. I'm trying to fire a query which will return and array of a property in my collection.
Sample Docs :
{
"_id" : ObjectId("5e940d6c2f804ab99b24a633"),
"accountId" : ObjectId("7e1c1180d59de1704ce43557"),
"description":"some desc",
"configs": {},
"dependencies" : [
{
"commute" : {},
"distance" : {},
"support":{}
}
]
}
Expected output :
{
[0]:commute
[1]:distance
[2]:support
}
I've tried to get the response and iterate the dependencies object also I tried using es6 to convert it to an array object. But it is an expensive operation as this list would be really large. If at all there exists and such approach in Mongo to convert the response into array
dependenciesfield into an array ?