title: Are DocumentDB stored procedures safe for simultaneous executions by multiple clients?
body: <p>How can I ensure each execution of a stored procedure can complete it's entire transaction without the document state being modified by another simultaneous execution of the same procedure by another client?</p>
  
  <p>Is there anything I need to do to ensure a lock on the documents that are being modified?<br>
  Is there a way to implement something like a T-SQL <code>TRANSACTION</code> to ensure that the entire operation is rolled back if an error occurs?</p>