UNPKG

seedgoose

Version:

Mongoose data seeding with smart id references tracking.

13 lines (10 loc) 316 B
const mongoose = require('mongoose'); const { Schema } = mongoose; const { ObjectId } = Schema.Types; const commentSchema = new Schema({ content: { type: String, trim: true }, comments: [{ type: ObjectId, ref: 'Comment' }] }, { timestamps: true }); module.exports = mongoose.model('Comment', commentSchema);