Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

custom timestamp name mongoose

const mongoose = require('mongoose');  
const { Schema } = mongoose;
    
const schemaOptions = {
  timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' },
};

const mySchema = new Schema({ name: String }, schemaOptions);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #custom #timestamp #mongoose
ADD COMMENT
Topic
Name
5+8 =