Table and Bag
Dynamic fields in IOTA allow developers to extend existing objects by adding or removing fields on-the-fly.
However, deleting an object that still has dynamic fields, especially non-drop fields, can lead to issues, particularly with on-chain collections holding numerous key-value pairs.
To mitigate this, IOTA offers specialized collections—
Table and
Bag—built on dynamic fields but equipped with mechanisms to count entries and prevent accidental deletion when non-empty.
IOTA also offers ObjectTable
and ObjectBag for scenarios
requiring visibility of stored objects, accessible via their ID in external storage.