goulash1971/mongoose-joins

monkey business

Closed this issue · 0 comments

I don't understand why there's differences between loading the types, plugins or patches. I don't understand when you would need only one of the three.

I also don't understand why the monkey patching function joins.install() would return the types. aren't these accessible from somewhere else? If I have 20 Model files and I need to make joins between those, I wouldn't want to do the monkey patching in each file just to get to the type values it returns.

Could the types be placed in what you get back from require('mongoose-joins');

var mongoose = require('mongoose');
var mongoose_joins = require('mongoose-joins');

my_model_schema = {
...
myConnectedEntity: {
type: new mongoose_joins.FkJoin(options)
}
...
}