Best practice for handling version errors

22 views
Skip to first unread message

Joe Wagner

unread,
Sep 6, 2013, 3:52:36 PM9/6/13
to mongoo...@googlegroups.com
I have models that contain a field which is an array of mixed types.
For example, { arrfield: [ { name: "Joe" }, { name: "Steve" } ] } 

The values in the array are updated quickly at times.  I read Aaron Heckmann's blog post about versioning, and I understand the reason for versioning.  My question is how to handle retrying an update that failed because of a version error?  I created a gist here that demonstrates an option that wraps the generic function you are using to update your model.

All I want to do is refetch the model and retry the update, has anyone run across a better way to handle this in an extendable way?

thanks,
-Joe
Reply all
Reply to author
Forward
0 new messages