[14:41:08] <pagios> hello, is there a way to return the elemented in an array to be sorted by date from oldest to newest?
[14:41:44] <pagios> i am already returning documents sorted by date, but each doc has also an array and inside that array i have dates too that i would like to sort too
[15:12:15] <VectorX> pagios you may need to use unwind, https://docs.mongodb.com/manual/reference/operator/aggregation/unwind/
[15:13:45] <pagios> VectorX: hello, i tried did db.events.find({_id:3}).sort({ "content.date" : 1 } ) doesnt sort by date
[15:14:24] <pagios> VectorX: can i add to the beginning of an array when i push to an array ?
[15:16:15] <VectorX> you would have to use aggregate and not find, then unwind the inner array and sort it
[15:17:59] <VectorX> there is an example here https://stackoverflow.com/questions/15388127/mongodb-sort-inner-array
[15:18:12] <pagios> i am thinking of #$push and $position
[15:19:52] <VectorX> wouldnt that just complicate the situation?
[15:21:27] <VectorX> you wouldnt know the order anyway, and if you are writing items to the array chronological, your list would automatically be sorted in ascending order