I am currently managing 2 collections.
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"
});
Here's my question:
I want to know how I can retrieve records from the BorrowerDetails Collection based on a specific type from the ItemList Collection.
For example, fetching all records from the BorrowerDetails Collection where the key is equal to the id of a record in the ItemList Collection with a type of "Desktop".
return BorrowerDetails.find(
{ key :
ItemList.find(
{ type : 'Desktop' },
{ fields: {'_id':1 } }
)
}
); //error!