How can I allow Collection Data query Limit more than 1000?

I already concat dataset using .limit(), .skip(). However, dropdown2 didn’t work on my website .
What is the problem? and are there any other ways to make dropdown button work?
Thank you for your opnion in advance. :slight_smile:

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);

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

function getUniqueTitles(items){
const titlesOnly=items.map(item => item.gu);:wink: //“gu” is key
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList){
return uniqueList.map(curr =>{
return {label:curr,value:curr};
});
}

}

If you are looking to query all the items in your database. Do this.

function something() {
  fetchData()
  .then( (items) => {
     console.log(items);
  });
}

async function fetchData() {
 let result = await wixData.query('myDatabase')
    .limit(1000)
    .find();
    let allItems = result.items;
    while (result.hasNext()) {
        result = await result.next();
        allItems = allItems.concat(result.items);
    }
    return allItems;
}

Thank you for your help. I solved the problem.