The map built-in functions are used to create maps. Maps store name-value pairs in an in-memory data structure. You can also persist a map to disk by storing it in a document. Some programming languages implement maps using hash tables, but these map functions make it convenient for you to create and update your own maps.
Maps are represented using the map:map XQuery primitive type. When you serialize an object of map:map type, it serializes to an XML node in the http://marklogic.com/xdmp/map namespace.
map:map
http://marklogic.com/xdmp/map
map:clear($table) => ()
map:count($table) => 15
map:delete($table, "some-key") => ()
map:get($table, "some-key") => <info>45683</info>
map:keys($table) => ("some-key", "another key", "and another one")
map:map() => map: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"> <map:entry> <map:key>some-key</map:key> <map:value><info>45683</info></map:value> </map:entry> </map:map> </result>