Use node-restful with mongoose.createConnection Use node-restful with mongoose.createConnection mongoose mongoose

Use node-restful with mongoose.createConnection


I looked in

https://github.com/baugarten/node-restful/blob/master/lib/model.js

I see that the code registers models with mongoose:

var result = mongoose.model.apply(mongoose, arguments)...

passing in the mongoose variable.

So node-restful always looks for a model registered on the default mongoose connection. The one you create by calling:

mongoose.connect("mongodb://localhost/resources");

You'll have to rewrite the node-restful code to allow passing in a connection instead of just using the mongoose instance. I'm not sure how easy or hard that will be do to.