var SchemaA = new Schema({ bs: [ { type: Schema.Types.ObjectId, ref: 'B' } ] });
var SchemaB = new Schema({ c: { type: Schema.Types.ObjectId, ref: 'B' } });
var SchemaC = new Schema({ ... });
var ModelA = mongoose.model('A', SchemaA);
var ModelB = mongoose.model('B', SchemaB);
var ModelC = mongoose.model('C', SchemaC);
ModelA.findOne({ ... }).populate('bs').populate('bs.c').exec( ... );
/home/marco/code/app/node_modules/mongoose/lib/model.js:1830
foundschema = schema.path(trypath);
^
TypeError: Cannot call method 'path' of undefined
at search (/home/marco/code/app/node_modules/mongoose/lib/model.js:1830:28)
at search (/home/marco/code/app/node_modules/mongoose/lib/model.js:1849:22)
at Function._getSchema (/home/marco/code/app/node_modules/mongoose/lib/model.js:1856:5)
at populate (/home/marco/code/app/node_modules/mongoose/lib/model.js:1594:22)
at Function.Model.populate (/home/marco/code/app/node_modules/mongoose/lib/model.js:1573:5)
at model.populate (/home/marco/code/app/node_modules/mongoose/lib/document.js:256:22)
at Promise.WantController.show (/home/marco/code/app/routes/want.js:21:11)
at Promise.onResolve (/home/marco/code/app/node_modules/mongoose/node_modules/mpromise/lib/promise.js:162:8)
at Promise.EventEmitter.emit (events.js:96:17)
at Promise.emit (/home/marco/code/want/node_modules/mongoose/node_modules/mpromise/lib/promise.js:79:38)
--
--
http://mongoosejs.com - docs
http://plugins.mongoosejs.com - plugins search
http://github.com/learnboost/mongoose - source code
http://mongoosejs.tumblr.com/ - production examples
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
---
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.
--
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.
Populating references spanning more than two collections must be done manually using Model.populate(docs, options, callback).ModelA.findOne({ ... }).populate('bs').exec(function (err, doc) {ModelB.populate(doc, 'c', function (err, doc) {console.log(doc.bs.c)
--
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/d/optout.