My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How to update mongoose Schema after a day from one object to another object

Suraj Saini's photo
Suraj Saini
·Jun 11, 2019

I have a User Schema that has to object one for booking and seconde for history. after one day I want to push user booking data into history. how I can achieve this.

booking:[{
    date: Date,
    visitdate: Date,
    slote: String,
    msg: String,
    doctor: {type: Schema.Types.ObjectId, ref: 'Doctor'}
}],
history:[{
    date: Date,
    expiredate: Date,
    visitdate: Date,
    slote: String,
    msg: String,
    doctor: {type: Schema.Types.ObjectId, ref: 'Doctor'}
}],