سؤال

Givem that I have the Subdomain ID, do I need to do a find in order to get the Subdomain object?

e.g: I have to do Subdomain.find {_id: item.subdomain_id}, (err, subdomain) -> in order to get the object subdomain? It'd be much better just to do item.subdomain.

Thanks!

هل كانت مفيدة؟

المحلول

If you only have the _id you're still going to have to look-up the document itself. In Mongoose this can be done with Model.findById as described here: http://mongoosejs.com/docs/finding-documents.html#Model.findById

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top