map:put( $map as map:map, $key as xs:string, $value as item()* ) as empty-sequence()
Put a value into a map at the given key.
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() let $put := map:put($map, "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>