Transferring data from one collection to another

If WIX allows more than 1000 insert requests, then maybe, this code would work for more than 1000 items.

import wixData from 'wix-data'

export const copyRowsCount = async () => {
  let query = await wixData.query('Source').limit(1000).find()
  let allItems = query.items //this was the error.
  if (allItems.lenght > 0) {
    while (query.hasNext()) {
      query = await query.next()
      allItems = [...allItems, ...query.items]
    }
  } // This is going to retrieve all the items from the Source collection.

  let results = []
  allItems.forEach((item) => {
    for (let i = 0; i < item.count; i++) {
      results.push(wixData.insert('Destination', { title: item.title, isbn: item.isbn }))
    }
  }) //This is going to select the items to be added.
  await Promise.all(results)
}