Showing repeater data from array in a for loop

Hi. Trying to get a wix data filter to show items in a repeater after pushing values into an array.

/ Velo API Reference: https://www.wix.com/velo/reference/api-overview/introduction
import {session} from 'wix-storage';
import wixData from 'wix-data';

$w.onReady( function () {
    
    let memberid = session.getItem("memberid");
    let allarticleitems = [];

    wixData.query("RecentlyViewedArticles")
    .eq("memberId", memberid)
    .find()
    .then((results) => {

        if(results.items.length > 0) {
            let allitems = results.items;
            console.log(allitems); //see item below 
            
        
            for (let i=0; i<=allitems.length; i++){

                allarticleitems.push(allitems[i].articleId);
                console.log(allarticleitems);

                $w("#dataset1").setFilter( wixData.filter()
                        .eq("_id", allarticleitems)
            
                        )
                        .then( () => {
                        console.log("Dataset is now filtered");
                        } )
                        .catch( (err) => {
                        console.log(err);
                        } );

            }
        } else {
        // handle case where no matching items found
        }
    })
    .catch((err) => {
        console.log(err);
    });

    

});

Querying one database to get an “articleId”. and then using that “articleId”, I want to take all the ids got from the for loop, push them to an array, and then filter the repeater to show articles from another database using only those IDs to which the dataset is connected.

Hope that made sense.

Do help me out. TIA.