mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
replace all created to timestamps: true in db
This commit is contained in:
parent
5d65427a6e
commit
dd1f74da72
4 changed files with 11 additions and 22 deletions
|
|
@ -32,11 +32,12 @@ const messageSchema = mongoose.Schema({
|
|||
type: String,
|
||||
required: true
|
||||
},
|
||||
created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
isCreatedByUser: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
}, { timestamps: true });
|
||||
|
||||
const Message = mongoose.models.Message || mongoose.model('Message', messageSchema);
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ module.exports = {
|
|||
},
|
||||
getMessages: async (filter) => {
|
||||
try {
|
||||
return await Message.find(filter).exec()
|
||||
return await Message.find(filter).sort({createdAt: 1}).exec()
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return { message: 'Error getting messages' };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue