On Mon, November 5, 2012 14:40, Kevin Burton wrote: > I am mainly using it the context of initially populating a database. So > there isn't any danger of a race because there is only one user.
I understand this does not answer your question directly. I guess, it depends on your particular use case, but I thought I'd mention this. Assuming you construct your key based on your unique attribute(s) I'm wondering whether it makes sense instead of preventing a new document from being created to go ahead and update the existing record. Then you could reconcile data discrepancies based on revisions. I assume it depends on how those duplicates got in your data in the first place. If those duplicates meant to be updates (or upserts rather), then revisions seem to me a better approach. Alex
