I\'m using Mongoose, MongoDB, and Node.
I would like to define a schema where one of its fields is a date\\timestamp.
I would like to use this field in order
In case you want custom names for your createdAt and updatedAt
const mongoose = require('mongoose'); const { Schema } = mongoose; const schemaOptions = { timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' }, }; const mySchema = new Schema({ name: String }, schemaOptions);