Dataset Query for 9000 Items for Dropdown

I have an issue where i am trying to query a dataset of over 8000 items and return the results to a drop down menu. The issue i’m having is that the query will only lookup the 1st 1000 rows of the dataset. I already concat the data but It didn’t work. What should I do? Below is my code, how do i look up the full 9000 rows and return the results to a drop down menu ? (My dataset name is “wix19”)
Thank you for your opinion in advance.

import wixData from “wix-data” ;

//Filtering
async function fetchData() {
const onePage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.find();
const twoPage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 1000 )
.find();
const threePage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 2000 )
.find();
const fourPage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 3000 )
.find();
const fivePage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 4000 )
.find();
const sixPage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 5000 )
.find();
const sevenPage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 6000 )
.find();
const eightPage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 7000 )
.find();
const ninePage = await wixData.query( ‘wix19’ )
.limit( 1000 )
.skip( 8000 )
.find();

const allItems = onePage.items.concat(twoPage.items).concat(threePage.items).concat(fourPage.items).concat(fivePage.items).concat(sixPage.items).concat(sevenPage.items).concat(eightPage.items).concat(ninePage.items);

return allItems;
}

function uniqueDropDown1(){

const uniqueTitles=getUniqueTitles(allItems.items);
$w( “#dropdown2” ).options=buildOptions(uniqueTitles);

function getUniqueTitles(items){
const titlesOnly=items.map(item => item.gu);
return [… new Set(titlesOnly)];
}

function buildOptions(uniqueList){
return uniqueList.map(curr =>{
return {label:curr,value:curr};
});
}
}

export function dropdown2_change(event,$w){
uniqueDropDown2();
$w( “#dropdown3” ).enable();
}
function uniqueDropDown2(){
wixData.query( “wix19” )
.contains( “gu” , $w( “#dropdown2” ).value)
.limit( 1000 )
.find()
.then(results => {
const uniqueTitles=getUniqueTitles(results.items);
$w( “#dropdown3” ).options=buildOptions(uniqueTitles);
});
function getUniqueTitles(items){
const titlesOnly=items.map(item => item.dong);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList){
return uniqueList.map(curr =>{
return {label:curr, value:curr};
});
}
}

//Searching

export function dataset2_ready() {
$w( “#repeater1” ).onItemReady( ($item,itemData,index)=>{
$item( “$predict” ).text=itemData.price+ ‘’ +itemData.currency;
});
}
let lastFilterName;
let lastFilterdong;
let debounceTimer;
export function input1_keyPress(event) {
if (debounceTimer){
clearTimeout(debounceTimer);
debounceTimer=undefined;
}
debounceTimer=setTimeout(()=> {
filter($w( “#input1” ).value,lastFilterdong);
}, 200 );
}
function filter(name, dong){
if (lastFilterName !==name || lastFilterdong !== dong) {
let newFilter=wixData.filter();
if (name)
newFilter=newFilter.contains( ‘name’ ,name)
if (dong)
newFilter=newFilter.contains( ‘dong’ ,dong);
$w( “#dataset2” ).setFilter(newFilter);
lastFilterName=name;
lastFilterdong=dong;
}
}

// connecting dropdown and searching
$w.onReady(() => {
loaddong();
});
export function dropdown3_change_1(event, $w) {
filter(lastFilterName, $w( ‘#dropdown3’ ).value);
}
function loaddong() {
wixData.query( ‘wix19’ )
.find()
.then(res => {
let options = [{ “value” : ‘’ , “label” : ‘All dongs’ }];
options.push(…res.items.map(dong => {
return { “value” : dong.name, “label” : dong.name};
}));
$w( ‘#dropdown3’ ).options = options;
});

}

Hi,
What exactly do you mean by " will only lookup the 1st 1000 rows of the dataset", did you log the results of each query to make sure?
Is there an option that your sandbox and live collection aren’t synced and that’s why the results are different than expected?
If you want to fetch all items from a collection you can use query in a loop, it would look like this:

let allItems = [];
let hasNext = true;
let count = 0
while(hasNext){
    let result = await wixData.query('wix19')                      .limit(1000).skip(count).find();
    count += result.items.length;
    hasNext = result.hasNext();
    allItems.concat(result.items)
}

Or