title: Automatically update lastModified attribute in mongoDB document on change - Meteor
body: <p>I have a <code>lastModified</code> attribute in my <code>games</code> collection. At the moment I have to manually update the <code>lastModified</code> attribute on every change (current timestamp).</p>
  
  <p>Is it possible to update this attribute automatically when other attributes of the document will be changed?</p>
  
  <p>I use Meteor 1.0.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Sample document:</p>
  
  <pre><code>{ "controllerId" : "ACycCfrQuTtuMwjuJ", "body" : "ABC", "userId" : "5iE4P8HPoRCSHe6k8", "lastModified" : ISODate("2015-01-06T15:48:49.346Z"), "_id" : "CQbL49FP9rZkSF7yh" }
  </code></pre>
  
  <p>When changing attribute <code>body</code> it should be like this:</p>
  
  <pre><code>{ "controllerId" : "ACycCfrQuTtuMwjuJ", "body" : "XYZ", "userId" : "5iE4P8HPoRCSHe6k8", "lastModified" : ISODate("2015-01-06T19:41:19.888Z"), "_id" : "CQbL49FP9rZkSF7yh" }
  </code></pre>
  
  <p><code>lastModified</code> should automatically be updated when one of the other attributes changes.</p>