> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: queryComments(appId: string) # Method package: wixCommentsV2 # Method menu location: wixCommentsV2 --> comments --> queryComments # Method Link: https://dev.wix.com/docs/velo/apis/wix-comments-v2/comments/query-comments.md # Method Description: 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`](#commentsquerybuilder) object. The returned object contains the query definition, which is typically used to run the query using the [`find()`](#commentsquerybuilder/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`](#commentsqueryresult/items) property in [`CommentsQueryResult`](#commentsqueryresult). |PROPERTY |SUPPORTED FILTERS & SORTING |:---:|:---:| |`_id`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`contextId`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`resourceId`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`author.userId`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`author.memberId`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`author.visitorId`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`parentComment.id`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`replyCount`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`lt()`](/comments-query-builder/lt),[`le()`](/comments-query-builder/le),[`gt()`](/comments-query-builder/gt),[`ge()`](/comments-query-builder/ge),[`ascending()`](/comments-query-builder/ascending),[`descending()`](/comments-query-builder/descending)| |`voteSummary.netVoteCount`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`lt()`](/comments-query-builder/lt),[`le()`](/comments-query-builder/le),[`gt()`](/comments-query-builder/gt),[`ge()`](/comments-query-builder/ge),[`ascending()`](/comments-query-builder/ascending),[`descending()`](/comments-query-builder/descending)| |`status`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`in()`](/comments-query-builder/in)| |`rating`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`lt()`](/comments-query-builder/lt),[`le()`](/comments-query-builder/le),[`gt()`](/comments-query-builder/gt),[`ge()`](/comments-query-builder/ge),[`ascending()`](/comments-query-builder/ascending),[`descending()`](/comments-query-builder/descending)| |`reactionSummary.total`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`lt()`](/comments-query-builder/lt),[`le()`](/comments-query-builder/le),[`gt()`](/comments-query-builder/gt),[`ge()`](/comments-query-builder/ge),[`ascending()`](/comments-query-builder/ascending),[`descending()`](/comments-query-builder/descending)| |`marked`|[`eq()`](/comments-query-builder/eq),[`ne()`](/comments-query-builder/ne),[`ascending()`](/comments-query-builder/ascending),[`descending()`](/comments-query-builder/descending)| # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## queryComments example for dashboard page code ```javascript import { comments } from 'wix-comments.v2'; async function queryComments() { const { items } = comments.queryComments().find(); } ``` ## queryComments example for exporting from backend code ```javascript import { comments } from 'wix-comments.v2'; import { webMethod, Permissions } from 'wix-web-module'; import { elevate } from 'wix-auth'; const elevatedQueryComments = elevate(comments.queryComments); export const queryComments = webMethod( Permissions.Anyone, async (query, appId) => { try { const result = await elevatedQueryComments(query, appId); return result; } catch (error) { console.error(error); // Handle the error } } ); ``` ---