UNPKG

horse-generator

Version:
1 lines 548 B
"use strict";var mongoose=require("mongoose"),Schema=mongoose.Schema,schema=new Schema({parent:{type:mongoose.Schema.Types.ObjectId,refPath:"pre",required:!0},child:{type:mongoose.Schema.Types.ObjectId,refPath:"ref",required:!0},pre:{type:String,required:!0},ref:{type:String,required:!0},role:String},{timestamps:{},toObject:{virtuals:!0}});schema.pre("save",function(e){return this.wasNew=this.isNew,this.isNew&&(this.createdAt||(this.createdAt=this.updatedAt=Date.now)),this.updatedAt=Date.now,e()}),module.exports=mongoose.model("Ship",schema);