I have a user doc which stores the user name and an array of object that holds the email address for that user. Normally a User can have one or more emails and normally if there is more then one its flags a dflt email .
SELECT d._id,, d.name, e
FROM Contacts AS d
UNNEST d.emails AS e
WHERE d._type = 'user'
AND e.dflt = TRUE
The above gets me the user name and the email that is marked dflt, what i am looking for is to get a query that will get me the email no matter what if there is only one in the array or if it is more then the dflt one.
Is that possible ?