I have a collection which has about 5000 entries in it. This collections stores Customer information. I’m trying to get a list of all customers in the collection using the below code:
let options = {
“suppressAuth”: true ,
“suppressHooks”: true
};
let existingCustomers = await wixData.query(“Customers”).limit(1000).find(options); let allCustomers = existingCustomers.items; while (existingCustomers.hasNext()) {
existingCustomers = await existingCustomers.next();
allCustomers = allCustomers.concat(existingCustomers.items);
}
Debug your code in order to find the problem.
You can debug HTTP functions by adding console.log() calls to them. The information you log appears in your site’s Developer Console when previewing your site. Nothing is logged to the console when viewing the published version of your site. Since message logging only runs in preview, you need to call the testing version of your endpoints to see what is logged.
To debug using console.log() in an HTTP function:
Add the call to console.log() in your HTTP function’s code.
Save your site.
Preview your site.
Call the testing endpoint (the URL with _functions-dev ) from an external application.
The logged messages appear in your site’s Developer Console.