In following project structure I have a dependency between 2 custom MEAN.IO packages
/custom
- package1
- server
- controllers
- routes
- models
- model1.js
- server
- package2
- server
- controllers
- routes
- models
- model2.js
- server
model1 and model2 are both used in their own controllers, but I would like to implement an algorithm which uses both.
My first guess would be:
var Model2 = mongoose.model('Model2')
But this returns an error:
MissingSchemaError: Schema hasn't been registered for model "Model2".
My second guess was to include model again:
var model = require('../../../package2/server/models/model2'),
Meeting = mongoose.model('Meeting'), ...
Yet still no luck, is there anybody who knows how to include models from another package in mean.io?