error updating different document with same doctype

I have two php script, each of them is updating a different document under the same doctype. However, when I run these two script together, one of them failed by complaining that it can not get a lock on the document that the other script is updating.

I supposed I can udate different document under the same doctype at the same time. Or it is not possible?

In my php script, I didn’t use any transaction control.

It is possible to concurrently update two documents in the same doctype. I presume you are using XQuery update. It is important to note that XQuery first selects all documents to be updated. For all documents that qualifiy based on indexes XQuery needs to acquire at least read locks which will be upgraded to exclusive locks if a document in fact will be updated. In your scenario, I assume that your first update succeeds and the second update has the updated document in the index processor’s result set. Thus it tries to lock it, which is not possible because of the concurrent exclusive lock of the updating request. An appropriate index for the update query’s predicate might help.
If you are not using XQuery update, please provide a more detailed description.

Hope this helps.

Best regards