summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/routes/channels/#channel_id/messages/index.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/routes/channels/#channel_id/messages/index.ts b/src/routes/channels/#channel_id/messages/index.ts

index 7fdff809..cdc46d14 100644 --- a/src/routes/channels/#channel_id/messages/index.ts +++ b/src/routes/channels/#channel_id/messages/index.ts
@@ -71,9 +71,11 @@ router.get("/", async (req, res) => { id: { $gt: (BigInt(around) - BigInt(halfLimit)).toString(), $lt: (BigInt(around) + BigInt(halfLimit)).toString() } }); else { - query = MessageModel.find({ channel_id }).sort({ id: -1 }); + query = MessageModel.find({ channel_id }); } + query = query.sort({ id: -1 }); + const messages = await query.limit(limit).exec(); return res.json(