Reputation: 75
What is the query or aggregation operator I can use to get this ?
{"_id": "id1", "contacts": [{"phone": "xxx", "email":"[email protected]"}, {"phone":"yyy"}, {"phone":"zzz", "email":"[email protected]"}] }
{"_id": "id2", "contacts": [{"phone": "aaa", "email":"[email protected]"}, {"phone":"bbb"}, {"phone":"ccc"}] }
(just need phone numbers, other contacts.fields can be dropped)
{"_id": "id1", "contacts": ["xxx", "yyy", "zzz"] }
{"_id": "id2", "contacts": ["aaa", "bbb", "ccc"] }
Upvotes: 1
Views: 84