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 a query's results.

The fields() method returns only the specified fields in the query's results.

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

When fields() receives an empty or invalid property, the query behaves as follows:

  • When no fields are specified, the query 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

Properties to return.

Returns
Return Type:WixDataQuery
Did this help?