Skip to content

Instantly share code, notes, and snippets.

@OdongAlican
Created April 14, 2020 20:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save OdongAlican/08e4ce0f7d14bc7e475c471073b30247 to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
const { Schema } = mongoose;
const postModel = new Schema({
title: String,
author: {
type: Schema.Types.ObjectId,
ref: 'authors',
},
date: {
type: Date,
required: true,
},
});
module.exports = mongoose.model('posts', postModel);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment