I am trying to generate an auto Serial Number for my "ticketno". When a user created a new application ticket no will automatically increase by one. Can anyone tell me how can I do this?
Here is the Database Schema:
const mongoose = require('mongoose');
let kamFormSchema = new mongoose.Schema(
{
ticketno: { type: String, required: true },
kcpname: { type: String, required: true },
kcpcontact: { type: String, required: true },
kcpnid: { type: String, required: true },
companyname: { type: String, required: true },
ccategory: { type: String, required: true },
corporatecode: { type: String, required: true },
ccategorytype: { type: String, required: true },
ccategorysubtype: { type: String, required: true },
totalemp: { type: String, required: true },
msisdn: { type: String, required: true },
approvecategory: { type: String, required: true },
subcategory: { type: String, required: true },
file: { type: String },
date: { type: Date, required: true },
},
{ collation: { locale: 'en' } }
);
//var KamForm = mongoose.model('kamForm', kamFormSchema);
module.exports = mongoose.model('kamForm', kamFormSchema);