var Course = mongoose.model('Course',new Schema({
createdAt: Date,
updatedAt: { type: Date, 'default': Date.now },
city: String,
country: String,
description: String,
latitude: String,
longitude: String,
name: String,
status: Boolean,
Professor_idProfessor:{ type: Schema.Types.ObjectId, ref: 'User' },
School_idSchool:{ type: Schema.Types.ObjectId, ref: 'School'}
}));
var Section = mongoose.model('Section',new Schema({
createdAt: Date,
updatedAt: { type: Date, 'default': Date.now },
days: String,
name: String,
status: Boolean,
studentCount: Number,
time: String,
Course_idCourse:{ type: Schema.Types.ObjectId, ref: 'Course' }
}));
I want to find all sections who's parent course have the name 'Math'. I figured it would work like this:
Section.find({'Course_idCourse.name':'Math'},function(err,obj){
console.log(err,obj);
});
This does not work though. Any suggestions?
--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.