Sorting the property while fetching

Details here

I was saving data in weaviate cloud and one of the property is created_at of date type.

I want to fetch recent created_at files sorted in desc of limit 10.

I am uing weaviate 3.6.2 in Nodejs TS/JS

        const result = await myCollection.query.fetchObjects({
            // Use Sort.byProperty() to create the sorting object
            sort: {
                byProperty: 'name', // The property you want to sort by
                order: 'Asc'        // The order: 'Asc' or 'Desc'
              }
          });

I am not able to figure it out and getting errors.

Hello @100_Jayanth_Vunnam,

Welcome to the community — it’s great to have you with us!

You can sort by metadata properties - see the example below:

If you’re using Weaviate Cloud and we’re hosting your Weaviate instance, feel free to reach out to us anytime at support@weaviate.io (our ticketing system for our cloud users).

Best regards,

Mohamed Shahin
Weaviate Support Engineer
(Ireland, UTC±00:00/+01:00)