Phone.find {number : "12345678"}, (err,phone) ->
phone.forEach (item, i) ->
console.log item
console.log item.subdomain
console.log item.subdomain_id
console.log item.city
returns:
{ _id: 4e9b614e01c642c2be000002,
city: 'San Francisco',
country: 'US',
indicative: '234',
number: '12345678',
subdomain_id: 4e9b532b01c642bf4a000003 }
undefined
undefined
San Francisco
Why is the item.subdomain_id
returning undefined if it's in the document?
Edit:
I added subdomain_id to the Schema and it now works (item.subdomain_id), however, I'm not getting the subdomain document, only the ID. I want to get item.subdomain
and be able to call methods on it.
Thanks