How to query thread comments order by ASC

I am using https://docs2.amity.co/ , I can query comments from ‘first’ but the order is not in ASC.

Is there a way to query order by ASC?

const comments = CommentRepository.queryComments({ 
    referenceType: 'content',
    referenceId: referenceIdTest,
    parentId: id,
      filterByParentId: true,
      first: 5,
});

Any suggestion or help is much appreciated

Hello @Kamolla

Please be adviced that the official documentation of Amity Social Cloud is : https://docs.amity.co/ (without “2”) in it.

For your question, you can do:

import { CommentRepository, CommentSortingMethod } from '@amityco/js-sdk'

const comments = CommentRepository.queryComments({ 
    referenceType: 'content',
    referenceId: referenceIdTest,
    parentId: id,
    filterByParentId: true,
    first: 5,
    sortBy: CommentSortingMethod.FirstCreated,
});

Let me know if that worked for you!

J.

Thank you for very quick reply and support. It works!

1 Like