queryComments( )


Creates a query to retrieve a list of comments.

The queryComments() function builds a query to retrieve a list of comments and returns a CommentsQueryBuilder 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 CommentsQueryBuilder functions onto the query. CommentsQueryBuilder functions enable you to sort, filter, and control the results that queryComments() returns.

queryComments() runs with the following CommentsQueryBuilder default that you can override:

  • ascending("_id")

The functions that are chained to queryComments() are applied in the order they are called. For example, if you apply ascending("voteSummary.netVoteCount") and then ascending("replyCount"), the results are sorted first by the "voteSummary.netVoteCount", and then, if there are multiple results with the same "voteSummary.netVoteCount", the items are sorted by "replyCount".

The following CommentsQueryBuilder functions are supported for the queryComments() function. For a full description of the comment object, see the object returned for the items property in CommentsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),in()
contextIdeq(),ne(),in()
resourceIdeq(),ne(),in()
author.userIdeq(),ne(),in()
author.memberIdeq(),ne(),in()
author.visitorIdeq(),ne(),in()
parentComment.ideq(),ne(),in()
replyCounteq(),ne(),lt(),le(),gt(),ge(),ascending(),descending()
voteSummary.netVoteCounteq(),ne(),lt(),le(),gt(),ge(),ascending(),descending()
statuseq(),ne(),in()
ratingeq(),ne(),lt(),le(),gt(),ge(),ascending(),descending()
reactionSummary.totaleq(),ne(),lt(),le(),gt(),ge(),ascending(),descending()
markedeq(),ne(),ascending(),descending()
Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Comments
Read Comments
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
appIdstringRequired

App ID to query comments for.

Returns
Errors

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

Did this help?