Closed chacliff closed 9 years ago
@chacliff I'm sorry this went by the wayside! I will not create globals for the collections within this library (similar to what you'd find using sails.js), but you could achieve this fairly easily with an additional plugin or code snippet. In the newest version of dogwater, you would place key/values under server.plugins.dogwater.collections
onto node's global
object. In older versions of dogwater, the key/values live under server.plugins.dogwater
instead.
Keep in mind that waterline collections are decorated onto each request for convenience at request.collections
(formerly request.model
).
I ran into this issue the other day, for each controller i tend to use the same models to generally get information and perform queries, updates, and creates with waterline models. I was wondering if there was a way to declare the models globally so that they can be used without having to pull them from the request.server.model. Something along the lines of a var pet = getModel['pet'] at the top of the document. and then you can do pet.create(), pet.findOne, etc