This has been asked before but none of the answers were understandable by myself.
Using Meteor, I am pulling in a collection called Scrdata into a Select/Option. That works fine. Inside of the Option I am inserting the _id of that document. It all works fine.
<select class="selectfile">
<option>Click to Select</option>
{{#each cwCasesPending}}
<option value="{{_id}}">{{> allcase}}</option>
{{/each}}
</select>
<template name="allcase">
<div > {{last_name}}, {{first_name}}: {{facility}} - {{cwname}}</div>
</template>
I am attempting to do what should be an extremely simple matter, find one document by its id:
Template.caselist.events({
'change .selectfile': function(event, tmpl){
var ar = Scrdata.findOne({_id: $(event.target).val()});
console.log($(event.target).find('option:selected').val());
console.log(ar);
}
});
The Results in the console are:
ObjectID("56dab90a73176cc2deb25aaa")
undefined
My goal is, upon a change in the select block, to populate a form on that page. However, a find by _id does not work.
I am grateful for any insight and guidance. Thank you.