[英]What is The Best way to get date value in JavaScript to send in MongoDB.?
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.?我想从 React 获取日期值并想使用 Node.js 将其发送到 MongoDB。获取适合发送到 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 **忽略 **
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.