batchSize setting does not work while using apoc.export.json.data leading to OOM

APOC Version: 4.3.0.5.0

Neo4j Version : 4.3.10

Hello, I am using the apoc.export.json.data to export to file but the batchSize doesn't seem to work.

Reference link -> https://neo4j.com/labs/apoc/4.3/export/json/

MATCH (nod:User) MATCH ()-[rels:KNOWS]->() WITH collect(nod) as a, collect(rels) as b

CALL apoc.export.json.data(a, b, "knows.json",{batchSize:10000})

YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data

RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data

The batchSize in the response is not reflecting.

Screenshot 2022-10-14 at 8.09.08 AM.png

I did not see any references to a 'batchSize' option for the configuration for this family of apoc procedures. I see three: 'writeNodeProperties', 'stream', and 'jsonFormat'.

https://neo4j.com/labs/apoc/4.3/export/json/

You may want to refactor your query as follows, so you don't create a Cartesian product between your two match statements:

OPTIONAL MATCH (nod:User)
With collect(nod) as a
OPTIONAL MATCH ()-[rels:KNOWS]->() 
WITH a, collect(rels) as b
CALL apoc.export.json.data(a, b, "knows.json", {})
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data