view:set-columns( $schema-name as xs:string, $view-name as xs:string, $columns as element(view:column)* ) as empty-sequence()
This function replaces the current set of column specifications on the named view in the named schema with a new set of columns.
xquery version "1.0-ml"; import module namespace view = "http://marklogic.com/xdmp/view" at "/MarkLogic/views.xqy"; view:set-columns("main", "songs", ( view:column("uri", cts:uri-reference()), view:column("title", cts:element-reference(xs:QName("TITLE"))), view:column("author", cts:element-reference(xs:QName("AUTHOR"))), view:column("album", cts:element-reference(xs:QName("ALBUM"), ("nullable"))), view:column("year", cts:element-reference(xs:QName("YEAR"))) ) ) (: Sets five columns in the 'songs' view in the 'main' schema. :)