Fix mongoose query

This caused an "Invalid sort() argument." error when accessing groups.
Merge pull request #1981 from ThibG/develop

Fix mongoose query