Comment queries return Live Collections that automatically update when comments are added, edited, or deleted, providing real-time updates across all connected clients.
Common Use Cases
Social Media
Load parent comments with expandable replies, and infinite scroll for engaging social discussions.
News Comments
Display chronological comments with sorting options, moderation features, and user reputation indicators.
Forum Discussions
Implement threaded discussions with unlimited nesting, search functionality, and user mention notifications.
Product Reviews
Show product feedback with rating filters, verified purchase indicators, and helpful vote sorting.
Always implement proper pagination to ensure optimal performance and user experience. Consider your application’s specific threading requirements when choosing between flat, two-level, or infinite threading strategies.
Reference Types
Comments can be queried from different types of content by specifying the appropriate reference type.Reference Type | Description | Use Cases |
---|---|---|
post | Comments on regular posts | Social media feeds, blog posts, news articles |
story | Comments on story content | Temporary content, social stories |
content | Comments on specialized content | Media galleries, documents, custom content |
Query Options
The ability to query comments and their replies is essential for creating robust commenting experiences. Use various parameters to filter and organize comments based on your application’s needs.Parameter | Type | Description |
---|---|---|
referenceId | String | ID of the content being commented on (post, story, etc.) |
referenceType | Enum | Type of content (.post, .story, .content) |
parentId | String? | Filter by parent comment ID (null for top-level comments) |
includeDeleted | Boolean | Whether to include deleted comments in results |
dataTypes | Array | Filter by comment content types (text, image, etc.) |
Comment Threading
Top-Level Comments
Query parent-level comments by settingparentId
to null:
Reply Comments
Query replies to a specific comment by providing the parent comment ID:Content Type Filtering
Filter comments by their content types using thedataTypes
parameter:
Filter Options
Filter Type | Description | Example Use Case |
---|---|---|
any | Comments containing at least one specified type | Show comments with images OR text |
exact | Comments containing all specified types | Show comments with images AND text |