Map Functions

apoc.map.flatten(map,delimiter:".")

flatten a nested map into a single-level map, for example turning {parent:{child:1}} into {"parent.child":1}

apoc.map.fromNodes(label, property)

creates map from nodes with this label grouped by property

apoc.map.fromPairs([[key,value],[key2,value2],...])

creates map from list with key-value pairs

apoc.map.fromLists([keys],[values])

creates map from a keys and a values list

apoc.map.fromValues([key,value,key1,value1])

creates map from alternating keys and values in a list

apoc.map.merge({first},{second}) yield value

creates map from merging the two source maps

apoc.map.mergeList([{maps}]) yield value

merges all maps in the list into one

apoc.map.setKey(map,key,value)

returns the map with the value for this key added or replaced

apoc.map.removeKey(map,key,{recursive:true/false})

returns the map with the key removed (recursively if recursive is true)

apoc.map.removeKeys(map,[keys],{recursive:true/false})

returns the map with the keys removed (recursively if recursive is true)

apoc.map.clean(map,[keys],[values]) yield value

removes the keys and values (e.g. null-placeholders) contained in those lists, good for data cleaning from CSV/JSON

apoc.map.groupBy([maps/nodes/relationships],'key') yield value

creates a map of the list keyed by the given property, with single values

apoc.map.groupByMulti([maps/nodes/relationships],'key') yield value

creates a map of the list keyed by the given property, with list values

apoc.map.sortedProperties(map, ignoreCase:true)

returns a list of key/value list pairs, with pairs sorted by keys alphabetically, with optional case sensitivity

apoc.map.updateTree(tree,key,[[value,{data}]])

returns map - adds the {data} map on each level of the nested tree, where the key-value pairs match

apoc.map.values(map, [key1,key2,key3,...],[addNullsForMissing])

returns list of values indicated by the keys

apoc.map.submap(map,keys,[[defaults]],[fail=true])

returns submap for keys or throws exception if one of the key doesn’t exist and no default value given at that position

apoc.map.mget(map,keys,[[defaults]],[fail=true])

returns list of values for keys or throws exception if one of the key doesn’t exist and no default value given at that position

apoc.map.get(map,key,[default],[fail=true])

returns value for key or throws exception if key doesn’t exist and no default given