Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Stamos Bolovinos4,320 Points
Problem accessing field
Consider this query:
var id = db.posts.find().author; db.users.find(id) //works db.users.find(id).signupDate //returns nothing db.users.find().signupDate //works
What is the problem of the second query? Why can I not access the document objects property
db.users.find(id) will return an Array. So you need to declare the location of the array which is 0. Try db.users.find(id).signupDate.