Why does my orderings param not work?

Hi, according to this REST API document and @prismicio/client - v6 guide also the migration guide, I was trying to do a search function in a blog project.

For example, if user type 'dog' in the input area, my query would look like following code and I want the results ordered by publication date.
The custom type id is 'post', and the project is using @prismicio/client v6

client.getAllByType('post', { 
    predicates: [
    prismic.predicate.fulltext("my.post.uid", "dog")
    ], lang: "en" 
}, { orderings: "[document.last_publication_date desc]" });

If I write without predicate, it still not works

client.getAllByType('post', { 
    lang: 'en',
    orderings: {
        field: 'document.first_publication_date',
        direction: 'desc',
    },
});

I can get the result but the result array is not sorted by the last publication date, neither when I change it to last_publication_date.
Is there anything I didn't write correctly?

Hello @kelly_ke

Welcome to the Prismic community, and thanks for reaching out to us.

Your code looks good to me. Could you make a small change and check it works?

client.getAllByType('post', { 
    orderings: {
      field: 'document.first_publication_date',
      direction: 'desc',
    },
   lang: 'en',
});

If it still doesn't work, I'd love to dig into more.

Thanks,
Priyanka

@Priyanka Thank you for your help, it worked!

You are welcome @kelly_ke. I am happy to help. Let us know if you have any questions.