This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves an item from a collection.
The get()
method returns a Promise that resolves to the item with ID
itemId
from the specified collection, or null
if the itemId
is not
found. The Promise is rejected if the current user does not have read
permissions for the collection.
If the specified collection contains reference fields, the ID of the
referenced item is returned. To return the values of the referenced items
use query()
and include()
.
If the get()
method is passed the ID of a hidden item, it returns null.
Calling the get()
method triggers the beforeGet()
and afterGet()
hooks if they have been defined.
Notes:
query()
or get()
methods or another data retrieval method immediately following a change to your database collection, the data retrieved may not contain your most recent changes. Learn more about Wix Data and Eventual Consistency. To solve this, you can use the setTimeout()
method to delay retrieving data following any changes to your database collection.itemId
is required to retrieve an item even from a single-item collection.
ID of the collection item belongs to.
ID of the data item to retrieve.
Options to use when processing this operation.