How do I sort/order a MongoDB collection with TypeORM? This is hinted by TypeScript, but it doesn't seem to work:
const collection = await this.repository.find({
where: { id: id },
order: { dateCreated: 'DESC' },
});
I couldn't find much in the docs about sorting with MongoDB in TypeORM
EDIT:
The source of my problems was the unit test I was the testing the function with. When I got the database dump, then I saw that indeed this code works.
So this question should be closed.