Transferring data from one collection to another

Hi Bruno,

Thank you for your quick response.

I get the following errors when I try this code.
Property ‘hasNext’ does not exist on type ‘any
Same error for property ‘next’

Here’s the code:

export const copyRowsCount = async () => {
let { items } = await wixData . query ( ‘bookList’ ). limit ( 1000 ). find ()
let allItems = items
if ( items . length > 0 ) {
while ( items . hasNext ()) {
allItems = [… allItems , await items . next ()]
}
} // This is going to retrieve all the items from the Source collection.

let results =
allItems . forEach (( item ) => {
console . log ( item . count )
for ( let i = 0 ; i < item . count ; i ++) {
results . push ({ title : item . title , isbn : item . isbn })
}
}) //This is going to select the items to be added.

await wixData . insert ( ‘Destination’ , results )
}

Any help would be appreciated.

Thanks,
Ron