AccessPlan.prototype.lockForUpdate( [lockUriCol as ColumnIdentifier?] ) as ModifyPlan
Gets an early lock on documents that will be updated later in the pipeline with an operation like remove() or write(). Documents are always locked, but for complex pipelines, it can be beneficial to lock the document early, so to minimize the potential for lock contention.
Parameters | |
---|---|
lockUriCol | If this column is not specified then it assumes a column 'uri' is present. The column, which contains URIs, can be named with a string or a column function such as op.col, op.viewCol, or op.schemaCol, or constructed from an expression with the op.as function. |
declareUpdate(); const op = require('/MarkLogic/optic'); op.fromDocDescriptors([{uri:"/test.xml", doc:{"desc":"write1"}}]) .lockForUpdate() .write() .result();
declareUpdate(); const op = require('/MarkLogic/optic'); op.fromDocDescriptors([{uri:"/test.xml", doc:{"desc":"write1"}}]) .lockForUpdate("uri") .write() .result();
declareUpdate(); const op = require('/MarkLogic/optic'); op.fromDocDescriptors([{uri:"/test.xml", doc:{"desc":"write1"}}],"myQualifier") .lockForUpdate(op.viewCol("myQualifier","uri")) .write(op.docCols("myQualifier", ["uri", "doc"])) .execute();
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.