Note that this is not quite true. Changes to documents are not visible to other code in the same statement, but when executing a multi-statement transaction, changes made in one statement are visible to subsequent statements within the same transaction.
So a transaction can read a modification it has done itself, but only if it is a multi-statement transaction. From: [email protected] [mailto:[email protected]] On Behalf Of Florent Georges Sent: Sunday, October 16, 2016 5:03 AM To: MarkLogic Developer Discussion <[email protected]> Subject: Re: [MarkLogic Dev General] search after xdmp.documentInsert() getting 0 results It looks like you try to read a document you inserted in the same transaction. Which is in contradiction with how transactions work on MarkLogic. You can think of it as the following simplification: all changes to documents (including inserting new ones) are accumulated whilst your code is executing, then actually written to the database when the transaction automatically commits, after the code has completed. The same query therefore cannot read a modification it has done itself. Regards, On 16 Oct 2016 05:45, "Shiv Shankar" <[email protected]<mailto:[email protected]>> wrote: Hi, I tried all the possibilities in fetching the results using jsearch.search after using xdmp.documentInsert() ( I used declareUpdate() on top) in CPF process, but resulting no documents in the collection. After this process, when I do same search , I get the results. I used xdmp.commit() exclusively but in vein. Why it s taking time to persists the documents in to the database when I do with JavaScript? Any thoughts. Reegards Shiv. _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
