Pushing database links to an array

Hello,

as the title says, i have an array with links ‘/link1’, ‘/link2’ and ‘/link3’ and i want to .push them into array.

I have tried this code:

import wixData from 'wix-data';
var links = [];

wixData.query('database1').find().then((results) => {
        results.items.forEach((item) = {
 let link = "/" + item.product
            links.push(link)
        })
    })
    .catch((error) => {
 let errorMsg = error.message;
 let code = error.code;
    });

At the line 6 (let link = “/”…) i get an error saying that let is a reserved keyword:


Any help is appreciated.

Thanks!

up

I think you have a syntax error in this line:
results.items.forEach((item) = {
Should be:
results.items.forEach((item) => {

Came back to this and it really helped! Thank You!

But now i have another problem. In the array that i am referring to i have 100 items, and no matter how many i add or remove, the script only sees the 50 latest added items.

Any idea of why that is?

.limit(500) missing in the query (Standard is 50)