comment.js 408 B

12345678910111213141516171819202122232425
  1. // 引入mongoose
  2. const mongoose = require('mongoose');
  3. const commentSchema = new mongoose.Schema({
  4. aid: {
  5. type: mongoose.Schema.Types.ObjectId,
  6. ref: 'Article',
  7. },
  8. uid: {
  9. type: mongoose.Schema.Types.ObjectId,
  10. ref: 'User',
  11. },
  12. time: {
  13. type: Date
  14. },
  15. content: {
  16. type: String
  17. }
  18. });
  19. const Comment = mongoose.model('Comment', commentSchema);
  20. module.exports = {
  21. Comment
  22. }