Help needed with MongoDB!
My Schema looks like this (exact code here)
const mongoose = require('mongoose');
const userSchema = new mongoose.Schema({
number: {
type: String,
required: 'Number cannot be blank',
unique: true,
},
messages: [
{
type: String
}
],
media: [
{
type: String
}
],
logs: [
{
type: String,
}
]
});
const User = mongoose.model('User', userSchema);
module.exports=User;
I want to do these things below:
- Make the
logs
expire after 24 hours - store the
logs
in the DB by the latest one which was created
Stack = Node + Express + MongoDB (using mongoose)