Question!~ Please Elppp!

I have 2 collection.
ItemList = new Mongo.Collection(‘items’);
BorrowerDetails = new Mongo.Collection(‘borrow’);

ItemList.insert({
brand: “brand-Name”,
type: “brand-Type”,
._id: id
});

BorrowerDetails.insert({
key: “ItemList._id”, //equals to ._id of the ItemList Collection
name : “borrowerName”
});

Question !
How can i retrieve records from the BorrowerDetails Collection based on a certain type from the ItemList Collection.

ex. Retrieve all records from the BorrowerDetails Collection where key is equals to the id of a record on the ItemList Collection whose type is equals to “Desktop”.

return BorrowerDetails.find({key:ItemList.find({type:‘Desktop’},{fields: {’_id’:1}})}); //error! :frowning: Elppp I am new in meteor.

hello, if you read the docs, you will discover that ItemList.find does not do what you expect and you may be expecting BorrowerDetails.find to not return a cursor either.

read up on findOne and also read up on fetch().

Docs and tutorial are excellent.