How to fetch record montly wise ? For Example junary totalopd , february totalopd. schema is following in detail section

const opdSchema = Schema({

generalopd:{

    type:String,

    required:true

},

opdmedical:{

    type:String,

    required:true

},

surgicalopd:{

    type:String,

    required:true

},

gynaeobsopd:{

    type:String,

    required:true

},

paediatricsopd:{

    type:String,

    required:true

},

nephrologyopd:{

    type:String,

    required:true

},

dental:{

    type:String,

    required:true

},

totalopd:{

    type:String,

    required:true

},



date:{

    type:Date,

    required:true

},

name:{

    type:String,

    require:true

},

userId:{

    type:Schema.Types.ObjectId,

    ref:'user'

}

},{timestamps:true});

I want to show totalopd of each month?
For Example:
jun totalopd = 7,
feb totalopd = 17,
march totalopd = 33
may , june …

Hi @Masaud_noor
Welcome to the community Forum!!

Could you please help me to understand what totalopd field saves in the collection.
Also, please share a sample document data to understand better.

Thanks
Aasawari

Ui

Hi @Masaud_noor

Could you please help me understand this with a sample document?

Thanks
Aasawari