My challenge involves managing two collections: users and items. Within the user.profile.savedItems array, items are saved in the following format: {"itemId" : "yHud5CWpdPaEc6bdc", "added" : ISODate("2014-09-12T22:28:11.738Z")}
My goal is to retrieve the saved items from the user profile (which I have accomplished) and sort them based on the added date.
Currently, here is the code snippet that I am using:
return {items: Items.find({_id: {$in: _.pluck(Meteor.user().profile.savedItems, 'item')}})};
I am uncertain if achieving this using standard MongoDB syntax is possible.