Designing a mongodb/meteor availability schema
<p>I'm trying to build a small site where people can book users for day-long gigs. I am using the accounts package from meteor and my plan is to attach the following:</p>

<pre><code>user.availability: [ 
                     {   
                       status: n, //where n is 0-# of status types (5 atm) : single char rather than float   
                       date: ddmmyyy, //string as well, no need for time as its day long   
                       job_id: {Job} 
                     }, ... 
                   ]
</code></pre>

<p>Job just has information like where,what,when.</p>

<p>There are 5 states: neutral, available, explicitly unavailable, booked, hold. Users are naturally neutral and explicitly have to state availability. They choose between the first three states: n,a,u and are only allowed to set availability max two weeks into the future. Job "givers" are the ones that set the other two availability states. A neutral state to me means they don't need a record in the db (user.availability array). </p>

<p>This style sets me up for the following query:</p>

<pre><code>db.users.find({ availability: { status: 'a', date: { $in: search_dates_array }});
</code></pre>

<p>And when a user logs in/accesses the site, I can wipe any availability settings they have for dates prior to the current date. Inactive users are pruned on a much longer interval.</p>

<p>I see this solution as beneficial in that it stores minimal amounts of information, requires little maintenance that can be triggered by specific events, and is easy to query. But I'm not 100% sure if this is the correct way to leverage mongodb's strengths. I would appreciate any help on this and if someone could point me to a (relatively) easy to digest article on optimizing mongodb schemas, that'd be awesome.</p>

<p>Thank you.</p>