I have an object stored in MongoDB that looks like this:
{ _id: 123 name: "xyz" attrib: { address: "123 xyz rd", phone: "123-456-7890" } }
I want to smooth this structure, so there is no attrib field, I only have the address and phone field along with name and _id .
So far this is what I have tried:
db.emp.aggregate( { $project : { { addr : '$review.attrib.address' }, { phn : '$review.votes.phone' }, } } );
Can someone help me further?
source share