Search.../

items

Returns an array of comments items that match the query.

Description

items contains the current page of results retrieved by the query. If no results match the query, items is an empty array. The page size is defined by the limit() function and can be retrieved using the pageSize property. You can use the next() and prev() functions returned by comments to navigate the pages of a query result.

Type:

Array<
Comment
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the comment was created.

_id
string

Comment ID.

_updatedDate
Date

Date and time the comment was last updated.

appId
string

ID of the app that the comment is added to.

author
CommentAuthor

Comment's author.

content
CommentContent

Published comment content.

contextId
string

ID of the specific context the comment is in response to.

Within some Wix apps, the contextId will be the same as the resourceId. For example in Wix Forum, the forumPostId is used as both the contextId and the resourceId.

contextType
string

Reserved for internal use.

marked
boolean

Whether the comment is marked.

parentComment
ParentComment

Parent comment information.

See Terminology for more information about parent comments.

rating
number

Comment rating.

reactionSummary
CommentReactionSummary

Summary of reactions.

replyCount
number

Amount of comments that reply to this comment.

resourceId
string

ID of the specific resource that the comment is in response to.

Within some Wix apps, the resourceId will be the same as the contextId. For example in Wix Forum, the forumPostId is used as both the resourceId and the contextId.

revision
string

Revision number, which increments by 1 each time the comment is updated.

To prevent conflicting changes, the current revision must be passed when updating the comment.

status
string

Comment status.

Supported values:

  • "PUBLISHED": This comment is published and publicly visible.
  • "DELETED": This comment is deleted.
  • "PENDING": This comment is pending moderation. Moderation is not currently supported.
  • "HIDDEN": This comment has been hidden by a site moderator.
voteSummary
VoteSummary

Summary of votes.

Was this helpful?

Get items from a query result

Copy Code
1const returnedItems = results.items;
2
Perform a query and get items from the result

Copy Code
1import { comments } from 'wix-comments.v2';
2
3export async function myQueryFunction() {
4 const results = await comments.queryComments().find();
5
6 const returnedItems = results.items;
7
8 if (returnedItems.length > 0) {
9 return items;
10 } else {
11 // Handle if no matching items found
12 }
13}
14