The max. limit of each querying-process of a database is = 1000.
If you need more data to load at once, you will have to generate a code, which do that function.
There are different options of doing this…
-query.limit(1000)
-query.skip(1000)
-query.hasNext()
-promiseAll()
EXAMPLE-1: (Not best one maybe, but should work…
async function getAllItems(databaseID, index, dbLimit) {
returnwixData.query(databaseID)
.limit(dbLimit)
.skip(index)
.find()
.then(async(res)=> {
itemData.push(res.items);
if (res.items.length===dbLimit) {
index += 1000;
return await getAllItems(databaseID, index, dbLimit)
} else {return itemData;}
});
}
//STARTING THE FUNCTION.....
$w.onReady(()=>{
let allItems = [];
let databaseID = "YourDatabaseIdHere";
let dbLimit = 1000;
let index = 0;
let dbFulldata = await getAllItems(databaseID, index, dbLimit);
console.log("Full-Data: ", dbFullData);
});
EXAMPLE-2:
async function fetchData(){
const firstPage = await wixData.query('collection')
.limit(1000)
.skip(0)
.find();
//-----------------------
const secondPage = await wixData.query('collection')
.limit(1000)
.skip(1000)
.find();
//-----------------------
const thirdPage = await wixData.query('collection')
.limit(1000)
.skip(2000)
.find();
//-----------------------
const allItems = firstPage.items
.concat(secondPage.items)
.concat(thirdPage.items);
return allItems;
}
Modifying this one into a loop, maybe would also be an alternative way.
But this is surely not best solution.
EXAMPLE-3:
async function fetchData() {
let result = await wixData.query('collection')
.limit(1000) .find();
let allItems = result.items;
while (result.hasNext()) {
result = await result.next();
allItems = allItems.concat(result.items);
}
return allItems;
}
Example-4: PROMISE-ALL-VERSION —> Here try to find out by yourself, probably the best version and the fastest…
a) https://community.wix.com/velo/forum/coding-with-velo/promiseall-issue
b) https://community.wix.com/velo/forum/velo-pro-discussion/get-unique-values-of-wished-db-fields-promiseall
c) search for more promiseAll examples inside the VELO-FORUM
And i could show you surely even more different versions, of how to solve your issue.
Take your time, do some testings, understand the codings and then create your own SOLUTION.
Good luck !!!