console.log(sourceDoc.id) let elements: object[] = [] await sourceDoc.load('relateds', (query) => query.select('id')) sourceDoc.relateds.forEach((element) => { element.id = randomUUID() element.documentId = tId elements.push(element.toJSON()) }) await Relateds.createMany(elements)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter