> ## Documentation Index
> Fetch the complete documentation index at: https://docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# coll.zip

> Combines two lists element-by-element into a list of pairs, stopping at the shorter list's length.

## Description

Combines two lists element-by-element into a list of pairs. Each pair contains one element from the first list and the corresponding element from the second list. The resulting list has the length of the shorter input list.

## Syntax

```cypher theme={null}
flex.coll.zip(list1, list2)
```

## Parameters

| Parameter | Type | Required | Description     |
| --------- | ---- | -------- | --------------- |
| `list1`   | list | Yes      | The first list  |
| `list2`   | list | Yes      | The second list |

## Returns

**Type:** list of lists

A list where each element is a two-element array `[item1, item2]` combining corresponding elements from both lists. Returns an empty list if either input is not an array.

## Examples

### Example 1: Basic Zipping

```cypher theme={null}
WITH ['a', 'b', 'c'] AS letters, [1, 2, 3] AS numbers
RETURN flex.coll.zip(letters, numbers) AS pairs
```

**Output:**

```text theme={null}
pairs
----------------------------
[["a", 1], ["b", 2], ["c", 3]]
```

### Example 2: Different Length Lists

```cypher theme={null}
WITH ['x', 'y', 'z'] AS keys, [10, 20] AS values
RETURN flex.coll.zip(keys, values) AS result
```

**Output:**

```text theme={null}
result
--------------------
[["x", 10], ["y", 20]]
```

(Only pairs up to the length of the shorter list)

### Example 3: Creating Key-Value Pairs

```cypher theme={null}
MATCH (p:Product)
WITH collect(p.name) AS names, collect(p.price) AS prices
RETURN flex.coll.zip(names, prices) AS productData
```

### Example 4: Pairing Related Data

```cypher theme={null}
WITH ['Mon', 'Tue', 'Wed'] AS days, [120, 135, 98] AS sales
UNWIND flex.coll.zip(days, sales) AS pair
RETURN pair[0] AS day, pair[1] AS salesAmount
```

## Notes

* Returns empty list if either input is not an array or is `null`
* Result length is limited by the shorter of the two input lists
* Excess elements from the longer list are ignored
* Useful for pairing related data or creating key-value associations

## See Also

* [map.fromPairs](/udfs/flex/map/fromPairs) - Convert pairs to a map
* [coll.union](/udfs/flex/collections/union) - Combine lists as sets

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What does flex.coll.zip return?">
    It returns a list of two-element lists (pairs), combining elements from two input lists by position. For example, `flex.coll.zip([1,2], ['a','b'])` returns `[[1,'a'],[2,'b']]`.
  </Accordion>

  <Accordion title="What happens if the input lists have different lengths?">
    The result length matches the shorter list. Extra elements from the longer list are ignored.
  </Accordion>
</AccordionGroup>
