This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const APP_SERVER_TO_DELETE = 'myApp'; | |
const admin = require('/MarkLogic/admin.xqy'); | |
let config = admin.getConfiguration(); | |
const groupId = fn.head(admin.getGroupIds(config)); // ASSUMPTION: only one group |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Set this to the output of app-server-components.sjs | |
const itemsToDelete = {"group":{"name":"Default", "id":"9058960804898839955"}, "appServer":{"name":"myApp", "id":"9351623035930725670"}, "contentDatabase":{"name":"myApp-content", "id":"743264865753505898", "forests":[{"name":"myApp-content-1", "id":"5044318450693390831"}, {"name":"myApp-content-2", "id":"12748819722917748087"}, {"name":"myApp-content-3", "id":"7007370367638532332"}]}, "modulesDatabase":{"name":null, "id":null, "forests":null}, "schemasDatabase":{"name":null, "id":null, "forests":null}, "triggersDatabase":{"name":null, "id":null, "forests":null}}; | |
// Keep hitting "run" until you see "All Done" | |
const admin = require('/MarkLogic/admin.xqy'); | |
let config = admin.getConfiguration(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
import module namespace sec="http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy"; | |
declare function local:get-role-names($role-ids) { | |
xdmp:invoke-function( | |
function() { | |
sec:get-role-names($role-ids) | |
}, | |
<options xmlns="xdmp:eval"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_comment": [ | |
"See https://go.microsoft.com/fwlink/?LinkId=733558", | |
"for the documentation about the tasks.json format" | |
], | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "mlDeploy", | |
"type": "shell", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
(: Configurable variables :) | |
declare variable $initial-radius := 1; (: miles :) | |
declare variable $radius-step := 5; (: miles :) | |
declare variable $radius-max := 100; (: miles :) | |
declare variable $total-matches := 1; | |
declare variable $lat-long-element-container := "FacilitySite"; | |
declare variable $lat-element := "LatitudeMeasure"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use VSCode with mlxprs or MarkLogic Query Console | |
let tdeDirectory = cts.uriMatch("/tde/*.tdex").toArray(); | |
tdeDirectory.map( u => { | |
let tdex = cts.doc(u); | |
return { u, valid: tde.validate([tdex]) }; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
let $ui-uris := cts:uri-match("/lib/*", "document") | |
for $u in $ui-uris | |
return | |
xdmp:eval(' | |
declare variable $u external; | |
declare variable $d external; | |
declare variable $p := ( xdmp:permission("rest-extension-user", "execute"), xdmp:permission("rest-admin", "update"), xdmp:permission("rest-admin", "read"), xdmp:permission("ui-role", "update"), xdmp:permission("ui-role", "read"), xdmp:permission("ui-role", "execute") ); | |
xdmp:document-insert($u, $d, $p) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(:: Decode a hex binary ::) | |
xquery version "1.0-ml"; | |
xdmp:save( | |
"D:\save.json", | |
binary{ xs:hexBinary( fn:doc("/big-json.xml")//hexbin/node() ) } | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |
declare namespace db ="http://marklogic.com/xdmp/database"; | |
let $constraint := cts:collection-query("content") | |
let $config := admin:get-configuration() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |
declare namespace db ="http://marklogic.com/xdmp/database"; | |
let $constraint := cts:collection-query("content") | |
let $config := admin:get-configuration() |
OlderNewer