queryReviews( )
Creates a query to retrieve a list of reviews.
Description
The queryReviews()
function builds a query to retrieve a list of reviews and returns a ReviewsQueryBuilder
object.
The returned object contains the query definition, which is typically used to run the query using the find()
function.
You can refine the query by chaining ReviewsQueryBuilder
functions onto the query.
ReviewsQueryBuilder
functions enable you to sort, filter,
and control the results that queryReviews()
returns.
The queryReviews()
function runs with the following defaults, which you can override:
ascending("_createdDate")
limit(100)
The functions that are chained to queryReviews()
are applied in the order they're called. For example, if you apply descending("_createdDate")
and then descending("content.rating")
, the results are sorted first by the _createdDate
, and then, if there are multiple results with the same _createdDate
, the items are sorted by content.rating
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
namespace | eq() ,ne() ,in() |
_id | eq() ,ne() ,in() |
content.rating | eq() ,ne() ,in() ,lt() ,le() ,gt() ,ge() ,ascending() ,descending() |
_createdDate | eq() ,ne() ,in() ,lt() ,le() ,gt() ,ge() ,ascending() ,descending() |
helpfulness | eq() ,ne() ,in() ,lt() ,le() ,gt() ,ge() ,ascending() ,descending() |
moderation.moderationStatus | eq() ,ne() ,in() |
Syntax
function queryReviews(options: QueryReviewsOptions): ReviewsQueryBuilder
queryReviews Parameters
NAME
TYPE
DESCRIPTION
Information about the reviews to retrieve.
Returns
Return Type:
Was this helpful?
queryReviews example
1import { reviews } from 'wix-reviews.v2';23 async function queryReviews() {4 const { items } = reviews.queryReviews().find();5 }6