mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
optimize convo paginations
This commit is contained in:
parent
c617b15bcd
commit
6ae154cc42
3 changed files with 17 additions and 10 deletions
|
|
@ -75,13 +75,14 @@ module.exports = {
|
|||
},
|
||||
// getConvos: async () => await Conversation.find({}).sort({ created: -1 }).exec(),
|
||||
getConvos: async (pageNumber = 1, pageSize = 12) => {
|
||||
// const skip = (pageNumber - 1) * pageSize;
|
||||
const limit = pageNumber * pageSize;
|
||||
const skip = (pageNumber - 1) * pageSize;
|
||||
// const limit = pageNumber * pageSize;
|
||||
|
||||
const conversations = await Conversation.find({})
|
||||
.sort({ created: -1 })
|
||||
// .skip(skip)
|
||||
.limit(limit)
|
||||
.skip(skip)
|
||||
// .limit(limit)
|
||||
.limit(pageSize)
|
||||
.exec();
|
||||
|
||||
return conversations;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue