title: Mongodb inserting object values
body: <p>I want to record user events to my mongodb collection.  Is it possible to set up a simple query to only store the last recorded time stamp for an event for an arbitrary, dynamically changing set of events (so when a new event is received, it is inserted)?  </p>
  
  <p>I know the following doesn't work, but i wanted to give an idea of what I'm thinking:</p>
  
  <pre><code>uievents.update({_id:id},{
      $set: {userName:user,
                     ("events."+eventName): {
                  eventName: eventName,
                  serverTime: curTime,
                  browserTime: btime,
                  value: value
              }},{$upsert:true});
  </code></pre>