title: Selecting a field in MongoDB that was passed from a data context
body: <p>My app generates a table using <code>#each events</code>.</p>
  
  <p>There are 4 event tickets per row (each row represents an event) and when you click on, for example, the first ticket, this is what's executed:</p>
  
  <pre><code>Template.displayEventsTable.events({
  
  "click .buyTicket1": function () {
  
      buyEventTicket(1, this._id);
  
  }
  </code></pre>
  
  <p>This is the <code>buyTicket</code>function:</p>
  
  <pre><code>function buyEventTicket (whatNumber, whatEvent) {
  
      var buyer = Meteor.user();
  
      console.log(whatNumber); // works
      console.log(whatEvent); // works
      console.log(whatEvent.eventTicketPrice); // currently shows up as "undefined"
  
    };
  }
  </code></pre>
  
  <p>The place I'm stuck with is trying to get the eventTicketPrice, which shows up as undefined. Despite reading through the Meteor and HandleBars docs, the light hasn't switched on yet as to what could be causing this.</p>
  
  <p>It doesn't seem logical that the event ID wouldn't return the proper value for one of its own fields. </p>
  
  <p>What have I missed?</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>HTML Template</p>
  
  <pre><code>&lt;template name="myEvents"&gt;
  &lt;h2&gt;Events&lt;/h3&gt;
            &lt;table&gt;
              &lt;tr class="first-row"&gt;
                &lt;th&gt;Ticket 1&lt;/th&gt;
                &lt;th&gt;Ticket 2&lt;/th&gt;
                &lt;th&gt;Ticket 3&lt;/th&gt;
                &lt;th&gt;Ticket 4&lt;/th&gt;
              &lt;/tr&gt;
              {{#each events}}
                {{#if eventsTypeA 1}}
                  {{&gt; displayEventsTable}}
               {{/if}}
              {{/each}}
            &lt;/table&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>Events Table Template</p>
  
  <pre><code>&lt;template name="displayEventsTable"&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;button class="buyTicket1 button-blue"&gt;Buy #1&lt;/button&gt;&lt;/td&gt;
      &lt;td&gt;&lt;button class="buyTicket2 button-blue"&gt;Buy #2&lt;/button&gt;&lt;/td&gt;
      &lt;td&gt;&lt;button class="buyTicket3 button-blue"&gt;Buy #3&lt;/button&gt;&lt;/td&gt;
      &lt;td&gt;&lt;button class="buyTicket4 button-blue"&gt;Buy #4&lt;/button&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <pre><code>_id: "YQXvUoBGKvhPObzFw"
  createdAt: Sat Jan 02 2016 22:47:35 GMT+0100 (CET)
  eventStatus: "open"
  eventTicketPrice: 30
  eventTickets: Array[4]
  __proto__: Object
  </code></pre>