Yesterday, I had a conversation on Discord in the OpenNTF channels around the AppDevPack. We talked about reading documents with all Items in them without knowing the item names beforehand.
Dan Dumont chimed in and told us about a not documented way to achieve this. So here's a sample code - but there's more to it. To make this work, you have to add a specific Role to the database ACL: [_ReadAllItems]. The proton user then must have this role. With this setting and the following code segment, you can read a document with all items at once:
const result = await db.bulkReadDocumentsByUnid({
unids: [<unique-ids go in here>],
itemNames: ['*'],});
That results in a structure like this (the document part):
This works with the document.read() method as well. Depending on the amount of items in the document, this might be a performance issue. In my toughest test sample with 250 items it wasn't - but something to keep in mind.
Thanks Dan and HCL for this nice hidden feature! Keep 'em coming!
Heiko.