Монгуз обновление создано
const schema = mongoose.Schema({
name: String,
createdAt: { type: Date, default: Date.now }
}, {
timestamps: { createdAt: false, updatedAt: true }
})
const Test = mongoose.model('test', schema);
const john = await Test.create({name: 'John Doe'});
console.log(john);
// Now that will work
const updatedJohn = await Test.findOneAndUpdate({name: 'John Doe'}, { createdAt: Date.now() });
console.log(updatedJohn);
aso