const mongoose = require('mongoose'); const SwitSchema = new mongoose.Schema({ text: { type: String, required: true }, user: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, likes: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }], username: { type: String, required: true }, comments: [{ text: { type: String }, user: { type: mongoose.Schema.Types.ObjectId, ref: 'User'}, date: { type: Date, default: Date.now}, username: String }], reposts: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User'}] }, { timestamps: true }); module.exports = mongoose.model('Swit', SwitSchema);