Hello,
I have a Code which works like a charm and gets all information of my database I need to display on my repeater.
However, the limit(1000) function is only checking up to 1000 lines in my database and does not include the rest.
I already found out that I need to include the next() and has next () function into my code.
But no matter how I do it I´m not able to make it running for all my database lines.
My code (without next() and has next(), that works perfect till limit(1000):
import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
$w ( ‘#PartnerOverview’ ). onReady (() => {
**let** user = wixUsers.currentUser ;
**let** userId = user.id ;
**let** itemUser = $w ( '#PrivateMember' ). getCurrentItem (). _id ;
**if** ( userId === itemUser ) {
$w ( "#listRepeater" ). onItemReady (( $item , itemData , index ) => {
});
wixData . query ( 'PartnerOverview' )
. eq ( "copyOwner" , userId )
. descending ( "datumReverse" )
. limit ( 1000 )
. find ()
. then (( results ) => {
**if** ( results.totalCount > 0 ) {
$w ( '#listRepeater' ). data = Array . **from** ( results.items . reduceRight (( m , t ) => m . **set** ( t.monat , t ), **new** Map ()). values ()). reverse ();
$w ( '#repeater2' ). data = Array . **from** ( results.items . reduceRight (( m , t ) => m . **set** ( t.besuchtesRestaurant , t ), **new** Map ()). values ()). reverse ();
} **else** {
$w ( '#listRepeater' ). hide ();
$w ( '#repeater2' ). hide ();
$w ( '#SammelnInfo' ). show ();
}
})
. **catch** (( error ) => {
console . error ( error );
});
$w ( '#SammelnInfo' ). hide ();
}
});
});
Now I want to include this Code (with next () and has next()) to check for the hole data:
async function retrieveAllItems () {
2 let results = await wixData . query (“myCollection”)
3 . limit ( 1000 )
4 . find ();
5 let allItems = results . items ;
6 while ( results . hasNext ()) {
7 results = await results . next ();
8 allItems = allItems . concat ( results . items );
9 }
10 return allItems ;
11 }
My main issue is to include this code into the code above, while maintaining the .then () function of my Code above.
Any ideas? Thanks