Use a variable for a field value in Mongo DB
<p>I need to query the following: </p>

<pre><code>Programs.find({ Teachers: { Week1: { Sunday: $elemMatch: { $eq: "MATT EDWARDS"}}}}).count();
</code></pre>

<p>...but the field "Week1" needs to be a dynamic value; it's depending on a variable's value. The variable is: </p>

<pre><code>var week = "Week" + Session.get('CurrentWeek').substr(0, 1);
</code></pre>

<p>A direct substitution won't work:</p>

<pre><code>Programs.find({ Teachers: { week: { Sunday: $elemMatch: { $eq: "MATT EDWARDS"}}}}).count();
</code></pre>

<p>I'm not sure how to build the object to it can be read inside the query. </p>