Database

db={"orders":[{a:"",b:1,"createdAccounts":{"test@gmail.com":{"id":["a","b","c"]}}}],"created":[{"by":"steevej","at":"gmail","dot":"com","for":"mongodb community forum 272555"}]}

Query

db.orders.aggregate([{"$project":{"createdAccounts":{$map:{input:{"$objectToArray":"$createdAccounts"},as:"item",in:{"user":"$$item.k","id":"$$item.v.id"}}}}}])

Result