semicolons (;) can be useful too. But the important part is to realize you will never "see" document updates in the same transaction. XQuery life is "frozen in time" to the point of the start of the query so all code "sees" the same view of the database until a transaction is complete.
(This is different than typical RDBMS transactions where you will see changes made on the same connection in an open transaction) ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 812-482-5224 Cell: +1 812-630-7622 www.marklogic.com<http://www.marklogic.com/> From: [email protected] [mailto:[email protected]] On Behalf Of Dave Cassel Sent: Tuesday, April 16, 2013 4:13 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Document insert For more details, the Understanding Transactions chapter<http://docs.marklogic.com/guide/app-dev/transactions#chapter> of the Application Developer's Guide is a good resource. What you'll probably need to do is have saveFunction run in an eval statement as a separate transaction. David Cassel Vanguard Technical Manager MarkLogic<http://www.marklogic.com> From: David Lee <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Tuesday, April 16, 2013 3:03 PM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] Document insert saveFunction and anotherFunction are run in the same transaction so anotherFunction will not "see" the new document until you commit the transaction. ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected]<mailto:[email protected]> Phone: +1 812-482-5224 Cell: +1 812-630-7622 www.marklogic.com<http://www.marklogic.com/> From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Chad Bishop Sent: Tuesday, April 16, 2013 2:57 PM To: [email protected]<mailto:[email protected]> Subject: [MarkLogic Dev General] Document insert Greetings, I have the following situation: let $var ... for ... where ... return let $a ... let $b ... let $save := saveFunction($param) return ($a, anotherFunction($b)...) That saveFunction is inserting a document...or supposed to. What I've found is it doesn't actually insert the document unless I: return $save Why is that? It matters in this situation because anotherFunction() depends on the document existing. Thank you for any help, -Chad
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
