#Mongoose helping

4 messages · Page 1 of 1 (latest)

nova sandal

Could someone help me write a mongoose aggregate query?
For reference, I have a user document that is created for every user. Each user document has an array of mutes with attached dates. How would I go through and find the most recent mute for each user?

limber boughBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
ember jackal

use dates

if you are not storing a timestamp for each "mute" or action performed on the user then you could use the array and get either the first or last element depending on how are you pushing them into it