title: Does updating a MongoDB record rewrites the whole record or only the updated fields?
body: <p>I have a MongoDB collection as follows:</p>
  
  <pre><code>comment_id (number)
  comment_title (text)
  score (number)
  time_score (number)
  final_score (number) 
  created_time (timestamp)
  </code></pre>
  
  <p>Score is and integer that's usually updated using $inc 1 or -1 whenever someone votes up or down for that record.
  but time_score is updated using a function relative to timestamp and current time and other factors like how many (whole days passed) and how many (whole weeks passed) .....etc</p>
  
  <p>So I do $inc and $dec on db directly but for the time_score, I retrieve data from db calculate the new score and write it back. What I'm worried about is that in case many users incremented the "score" field during my calculation of time_score then when I wrote time_score to db it'll corrupt the last value of score.</p>
  
  <p>To be more clear does updating specific fields in a record in Mongo rewrites the whole record or only the updated fields ? (Assume that all these fields are indexed).</p>