Skip to content

Instantly share code, notes, and snippets.

@jeffdonthemic
Created July 10, 2014 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffdonthemic/7f96d4e7711e8d390332 to your computer and use it in GitHub Desktop.
Save jeffdonthemic/7f96d4e7711e8d390332 to your computer and use it in GitHub Desktop.
Mongoose embedded documents
var mongoose = require('mongoose');
var problemSchema = new mongoose.Schema({
event: String,
problemName: String,
roundName: String,
roundId: Number,
roomId: Number,
componentId: Number
});
module.exports = mongoose.model('Problem', problemSchema);
var mongoose = require('mongoose');
var ProblemSchema = require('../models/Problem').Schema;
var userSchema = new mongoose.Schema({
email: { type: String, unique: true, lowercase: true },
password: String,
problems: [ProblemSchema]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment