Simultaneously Run a query

Hey there :raised_hand_with_fingers_splayed:

You don’t need something special to let the code run at the same time, just don’t wait for the promise to resolve.

$w.onReady(() => {
    // Promise #1
    wixData.query('collection1').find();
    
    // Promise #2
    wixData.query('collection2').find();
})

If you want to wait for both results before continue.

$w.onReady(() => {
    Promise.all([
        wixData.query('collection1').find(),
        wixData.query('collection2').find()
    ]).then((results) => {
        const firstResult = results[0];
        const secondResult = results[1];
    })
})

If you want to run them one after another

wixData.query('collection1').find().then(() => {
    wixData.query('collection2').find()
})

Hope this helps~!
Ahmad