Did you know Azure DocumentDB
, and user-defined functions (UDFs)
. In this post, we will take a closer look at DocumentDB’s interpretation of stored procedures.
High Performance Batching and Sequencing Operations
A major advantage with stored procedures is that they enable applications to perform complex batches and sequences of operations directly inside the database engine, closer to the data. Developers can group and sequence operations (like inserts, updates, or deletes) and submit them together. The benefit here is that the network traffic latency costs for batching and sequencing operations can completely avoided.
A sequence of database operations
A sequence of operations using Stored Procedures
. If an operation does not complete with that time limit, the transaction is automatically rolled back. In order to simplify development to handle time limits, all CRUD (Create, Read, Update, and Delete) operations
return a Boolean value that represents whether that operation will complete. This Boolean value can be used a signal to wrap up execution and for implementing a continuation based model to resume execution (this is illustrated in our code samples below).
Video Walkthrough, Code Samples, and More!
Can’t wait to get started? We’ve prepared a brief 5-minute video to walking you through the creation and execution of a stored procedure, available on Channel 9
We’ve also prepared a variety of new stored procedure examples including upsert
, and bulk-import
, available on our Github repo
. Want to share your awesome stored procedure? Please, send us a pull-request! We’d love to feature and spotlight you on our Github
accounts. To learn how to get started
with DocumentDB or for more information, please check out our website
. For more information regarding DocumentDB’s server-side programming model, check out our documentation here