How can I sort array values by DATE

Hi Couchbase Gurus,

  Need help, how can I sort array items Base By Date.

Here are my product documents. I want to sort the array items of orderSummary property by period.

[
	{
	   "id": "product::0010",
       "name": "AMINO ACID 750",
       "productCode": "0010",
       "orderSummary": [
	      {
	        "period": "2021-02-01T00:00:00.000Z",
	        "qtyOrdered": 60,
	        "qtyShipped": 60
	      },
	      {
	        "period": "2021-01-01T00:00:00.000Z",
	        "qtyOrdered": 8,
	        "qtyShipped": 8
	      },
	      {
	        "period": "2021-03-01T00:00:00.000Z",
	        "qtyOrdered": 12,
	        "qtyShipped": 12
	      }
       ]
	},
	{
	   "id": "product::0012",
       "name": "AMINO ACID 1000",
       "productCode": "0012",
       "orderSummary": [
	      {
	        "period": "2021-02-01T00:00:00.000Z",
	        "qtyOrdered": 12,
	        "qtyShipped": 12
	      },
	      {
	        "period": "2021-01-01T00:00:00.000Z",
	        "qtyOrdered": 21,
	        "qtyShipped": 21
	      },
	      {
	        "period": "2021-04-01T00:00:00.000Z",
	        "qtyOrdered": 21,
	        "qtyShipped": 21
	      }
       ]
	}
]
Here is my current N1QL query.

SELECT META(products).id, products.productCode, products.name, productOrders.orderSummary FROM `bucket` AS products LEFT JOIN `bucket` AS productOrders ON productOrders.product = META(products).id AND productOrders.location = 'bucket::location::75412' AND productOrders.`type` = 'product-order' WHERE products.`type` = 'product' AND products.tenant = 'tenant::bucket' ORDER BY products.productCode ASC

Thanks, Really need your help.
SELECT
  META(products).id,
  products.productCode,
  products.name,
  (SELECT RAW o FROM productOrders.orderSummary AS o ORDER BY o.period) AS orderSummary
FROM `bucket` AS products

LEFT JOIN `bucket` AS productOrders
  ON productOrders.product = META(products).id
  AND productOrders.location = 'bucket::location::75412'
  AND productOrders.`type` = 'product-order'

WHERE products.`type` = 'product'
AND products.tenant = 'tenant::bucket'
ORDER BY products.productCode ASC