Search.../

countComments( )

Developer Preview

Counts comments, given the provided filtering.

Description

For field support for filters and sorting, see Comments: Supported Filters and Sorting.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function countComments(appId: string, options: CountCommentsOptions): Promise<CountCommentsResponse>

countComments Parameters

NAME
TYPE
DESCRIPTION
appId
string

App ID to count the comments of.

options
Optional
CountCommentsOptions

Returns

Return Type:

Promise<
CountCommentsResponse
>
NAME
TYPE
DESCRIPTION
count
number

Amount of comments.

Was this helpful?

countComments example

Copy Code
1import { comments } from 'wix-comments.v2';
2
3 async function countComments(appId, options) {
4 try {
5 const result = await comments.countComments(appId, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13