Loading TOC...

MarkLogic 12 EA 2 Product Documentation
AccessPlan.prototype.lockForUpdate

AccessPlan.prototype.lockForUpdate(
   [lockUriCol as String]
) as ModifyPlan

Summary

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. This can be a string of the uri column name or an op.col. Use op.viewCol or op.schemaCol if you need to identify columns in the two views that have the same column name.

See Also

Example

declareUpdate();
const op = require('/MarkLogic/optic');

op.fromDocDescriptors([{uri:"/test.xml", doc:{"desc":"write1"}}])
.lockForUpdate()
.write()
.result();
  

Example

declareUpdate();
const op = require('/MarkLogic/optic');

op.fromDocDescriptors([{uri:"/test.xml", doc:{"desc":"write1"}}])
.lockForUpdate("uri")
.write()
.result();
  

Example

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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.