Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
How to generate auto serial number in MERN?

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);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

import mongoose from 'mongoose'
import {v4} from 'uuid';
await mongoose.connect("<YOUR MONGODB ADDRESS>")

const schema = new mongoose.Schema({
    serial: {
        type: String,
        default: v4
    }
})

const model = mongoose.model("test", schema)

await new model().save()

Image sorry i don`t have 10 rang

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!