Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

ref in mongoose example

var mongoose = require('mongoose')
  , Schema = mongoose.Schema

var eventSchema = Schema({
    title     : String,
    location  : String,
    startDate : Date,
    endDate   : Date
});

var personSchema = Schema({
    firstname: String,
    lastname: String,
    email: String,
    gender: {type: String, enum: ["Male", "Female"]}
    dob: Date,
    city: String,
    interests: [interestsSchema],
    eventsAttended: [{ type: Schema.Types.ObjectId, ref: 'Event' }]
});

var Event  = mongoose.model('Event', eventSchema);
var Person = mongoose.model('Person', personSchema);
Comment

PREVIOUS NEXT
Code Example
Javascript :: fullcalendar angular add events 
Javascript :: js time function 
Javascript :: jquery input hidden value 
Javascript :: in text includes in aray of objects 
Javascript :: antiforgerytoken mvc with ajax 
Javascript :: eslint disable tag 
Javascript :: update node js 
Javascript :: parse json to dart model 
Javascript :: js array.prototype.join 
Javascript :: js map object to array 
Javascript :: useeffect 
Javascript :: how to write in js 
Javascript :: prototype in javascript 
Javascript :: how to add base url as src in react native 
Javascript :: react alert popup 
Javascript :: remove element from array 
Javascript :: add webpack to react project tutorial 
Javascript :: mongoose express js require 
Javascript :: Check for a Null or Empty String in JavaScript 
Javascript :: nodejs read image as base64 
Javascript :: moment get month short name 
Javascript :: js push in object 
Javascript :: add array 
Javascript :: dropdown search field in react native 
Javascript :: create react without jsx 
Javascript :: how to dynamic title in nuxt 
Javascript :: firefox freeze page 
Javascript :: react big calendar event color 
Javascript :: js combine 2 array to object key value 
Javascript :: javascript copy array 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =