Download large amount of data partly

Hello, I am working with nextjs and mongodb.
I have a collection ‘products’ I get via api
About collection:
Size: 12MB
Records: 5’000

I am working with API and NextJs, so I can’t get a data from API request more than 4MB. I like to download data, for example, by 1000 records (every API call must be less than 4MB).

How can I do this type of manipulation?

1 Like

Hi @Il_Chi ,

Perhaps just chunk the query to return ~1000 docs or less each time.

You can either use _id ranges or limit and skip.



What @Pavel_Duchovny said was right. Here is some additional information on how to use the Limit operator:

1 Like