
ColumnBuilderPlan.prototype.expr( expression as String ) as ColumnBuilderPlan
Sets the expression to create content or extract content from a document for the column created by ColumnBuilderPlan.prototype.addColumn . It cannot be used together with ColumnBuilderPlan.prototype.xpath , as both of them define the content of the column.
| Parameters | |
|---|---|
| expression |
The expression to create content or extract content from a document. It's similar to the <val> element in TDE.
|
const op = require('/MarkLogic/optic');
op.fromDocs(
cts.collectionQuery("fromDocsJson"),
"/",
op.columnBuilder()
.addColumn("id").nullable(true).type("integer").default(-1)
.addColumn("name").collation("http://marklogic.com/collation/codepoint")
.addColumn("node").type("node").xpath(".")
.addColumn("expr").type("unsignedLong").expr(op.xdmp.random())
.addColumn("vector").type("vector").dimension(3)
.addColumn("geoData").xpath("geo").type("point").coordinateSystem("wgs84/double").units("miles"),
"myView", "myFragmentId"
)
.orderBy("id")
.select(["id","name","node","expr","vector","geoData","myFragmentId"])
.result()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.