map:with( $map as map:map, $key as xs:string, $value as item()* ) as map:map
Updates a map, inserting a value into it at the given key. The map is returned as the result.
Parameters | |
---|---|
map | A map. |
key | A key. If the key is not unique, it will overwrite the existing key. |
value | A value. If the value is the empty sequence, it will remove the key from the map. |
let $map := map:map() =>map:with("some-key",<info>45683</info>) return <result>{$map}</result> => <result> <map:map xmlns:map="http://marklogic.com/xdmp/map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <map:entry key="some-key"> <map:value> <info>45683</info> </map:value> </map:entry> </map:map> </result>