title: MongoDB Update and Insert in two different collection
body: <p><strong>What I have :</strong> Two collections </p>
  
  <ul>
  <li>User (Collection that contains user related information along with points he has)</li>
  <li>UserPoints (Collection which keeps track of when the point was given to user and when the points used by user. In short, a audit collection. UserPoints contains userId)</li>
  </ul>
  
  <p><strong>What I want :</strong> I want to update user's points in 'User' collections based on some criteria. At the same time I want to insert a document in 'UserPoints' collection for each user with entry of newly updated points and log.</p>
  
  <p><strong>What I Tried :</strong> I have written one updateMany query which I tried on some users which is working fine. It is updating user's point in 'User' collection. But problem is, I want userId who is been update so that I can make a entry in 'UserPoints' collection.</p>
  
  <p>Is there a way to do this in MongoDB? (I am using version 3.2)</p>
  
  <p>I was thinking of writing a simple C# program for this. </p>
  
  <p>Any suggestions?</p>