Reputation: 691
I have the following code:
var permalinkVar = this.params.permalink;
var imageVar = sites.find({'name':permalinkVar}).createdBy;
console.log(imageVar);
inside a route function, I'm trying to return the createdBy
property, but im not sure why but it's returning undefined. Can anyone help?
Upvotes: 1
Views: 179
Reputation: 11376
Thas because you are using .find()
instead of findOne
var imageVar = sites.findOne({'name':permalinkVar});
console.log(imageVar.createdBy);
.find()
returns the collection instance, where .createdBy
and name
doesn't exists.
Upvotes: 1