I have a document with a Array called ‘lastLogin’ which has all the recent timestamps.
I would like to overwrite this array with a single element being the last index value in the array.
lastLogin : [timestamp1,timestamp2,timestamp3]
lastLogin : timestamp3
loginTimes : 3
So overwrite the lastLogin array with a single value of the last index
Add a field called loginTimes which is the total count of the lastLogin Array. (edited)
Not sure exactly how to do this either using aggregation or normal commands.