I want to get the date value from React and want to send it to MongoDB using Node.js. What is the best way to get the date value that is suitable for sending to MongoDB.?
May be like that:
const tourSchema = mongoose.Schema({
title: String,
description: String,
name: String,
creator: String,
tags: [String],
imageFile: String,
**createdAt: {
type: Date,
default: new Date(),
},**
likes: {
type: [String],
default: [],
},
});
ignore **