fields( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Lists the fields to return in the search results.

The fields() method specifies which fields to return in the search results.

You can use include() together with fields() to get referenced items.

When fields() receives an empty or an invalid field, the search behaves as follows:

  • When no fields are specified, the search returns all fields.
  • When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.
  • When only invalid fields are specified, only the default _id field is returned.
Method Declaration
Copy
Method Parameters
fieldsArray<string>Required

Fields to return.

Returns
Return Type:WixDataSearch
Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?