I am writing an application using yeoman angular-fullstack, I defined some entities that I would like to access from other entities controller. For example I have in my server->api->Mall I have the following code:
var MallSchema = new Schema({
...
});
module.exports = mongoose.model('Mall', MallSchema);
in other Business controller I would like to search for Mall by _id, using mongoose, But I can not import MallSchema trying to do the following:
mall = mongoose.models("MallSchema").find({_id: "some_mall_id"})
business.mallType = mall.type
business.update();
or nesting Schema's
var MallSchema = new Schema({
business : Business;
});
I really tried in lot of ways, ending up with frustration, googling this yields lots of answers, none have works and few just seems too complicated like this one, I newbie to node.js so I mast been missing somthing simple. any help would be nice for the entire community.