Javascript Mongoose上的Post请求与Get请求不匹配

Javascript Mongoose上的Post请求与Get请求不匹配,javascript,mongodb,express,mongoose,Javascript,Mongodb,Express,Mongoose,我的MongoDB Atlas上存储的内容与我的post请求不匹配。我的数据库中只存储用户名,尽管post请求和模式中有tweet和日期。如何在数据库中显示推文和日期?谢谢 MONGODB模式: const mongoose = require("mongoose"); const Schema = mongoose.Schema; const tweetSchema = new Schema( { username: { type: String, re

我的MongoDB Atlas上存储的内容与我的post请求不匹配。我的数据库中只存储用户名,尽管post请求和模式中有tweet和日期。如何在数据库中显示推文和日期?谢谢

MONGODB模式:

const mongoose = require("mongoose");

const Schema = mongoose.Schema;

const tweetSchema = new Schema(
  {
    username: {
      type: String,
      required: true
    }
  },
  {
    tweet: {
      type: String,
      required: true,
      maxlength: 140
    }
  },
  {
    date: {
      type: Date,
      required: true
    }
  },
  {
    timestamps: true
  }
);

const Tweet = mongoose.model("Tweet", tweetSchema);

module.exports = Tweet;
快速路由器:

const router = require("express").Router();
let Tweet = require("../models/tweet.model");

router.route("/").get((req, res) => {
  Tweet.find()
    .then(tweet => res.json(tweet))
    .catch(err => res.status(400).json("Error: " + err));
});

router.route("/add").post((req, res) => {
  const tweet = req.body.tweet;
  const username = req.body.username;
  const date = Date.parse(req.body.date);

  const newTweet = new Tweet({
    username,
    tweet,
    date
  });

  newTweet
    .save()
    .then(() => res.json("Tweet added!"))
    .catch(err => res.status(400).json("Error: " + err));
});

module.exports = router;
后请求:

{
    "username": "yourfatuncle",
    "tweet": "first tweet",
    "date": "2020-03-19T08:28:49.271+00:00"
}
获取请求:

 {
        "_id": "5e6f48d349a86510646354ae",
        "username": "yourfatuncle",
        "__v": 0
    }
试试这个:

const tweetSchema = new Schema(
  {
    username: {
      type: String,
      required: true
    },
    tweet: {
      type: String,
      required: true,
      maxlength: 140
    },
    date: {
      type: Date,
      required: true
    }
  },
  {
    timestamps: true
  }
);
试试这个:

const tweetSchema = new Schema(
  {
    username: {
      type: String,
      required: true
    },
    tweet: {
      type: String,
      required: true,
      maxlength: 140
    },
    date: {
      type: Date,
      required: true
    }
  },
  {
    timestamps: true
  }
);

尝试更改:
newtweet({username:username,Tweet:Tweet,date:date})
仍然不起作用:*(您有错误的模式要更改:
newtweet({username:username,Tweet:Tweet,date:date})
仍然不起作用:*(您有错误的模式)