How to sort based on value of Doc in Array

How can i sort based on values in a array of docs. Below is the History Array which is part of a doc. There is 2 cases i would like to use, how would i use the sort or

a) Sort based on the DateTime Value
b) Sort based on the DateTime where Status is Active and Action Refresh

Also what would an ideal index look like

  "History": [
    {
      "Action": "Initial",
      "DateTime": "2020-04-21 16:11:38",
      "Status": "Active"
    },
    {
      "DateTime": "2020-04-23 08:05:06",
      "Action": "Refresh",
      "Status": "Active"
    },
    {
      "DateTime": "2020-04-23 08:10:05",
      "Action": "NoChange",
      "Status": "Active"
    }
  ]
SELECT   (SELECT 
         FROM d.History AS h
         WHERE h.Status IN [ "Active", "Refresh"]
         ORDER BY h.DatetTime ) AS History
FROM default AS d
WHERE ....

https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/subquery-examples.html