Closed awatson1978 closed 8 years ago
So currently you can always pass the {transform:null} to the second parameter of a find
or findOne
like normal and it will disable returning instances. Adding a second parameter to extendAndSetupCollection
would be a very feasible option. A opt out scenario would be ideal as this would not disrupt the current API and not break functionality of any of the other packages in the set.
Tentatively this would look like:
Book = BaseModel.extendAndSetupCollection("books", true);
Further thoughts are welcome.
Hi there, Taking a bit closer look at incorporating
socialize:base-model
into our existing apps, and I've been thinking about how to make refactor/upgrade paths for existing applications. Long story short, would it be possible to add an option to thefind()
andfindOne()
functions that control whether or not a class or document is returned?Specifically an if/then around line 64 should do the trick: https://github.com/copleykj/socialize-base-model/blob/master/base-model.js#L64
I'm not entirely sure whether the syntax should be affirmative or negative, but here are a couple ideas:
If we could add such functionality, then people could drop the
socialize:base-model
into existing apps without them breaking, and start migrating sections of their app without needing to overhaul the entire thing. The opt-in syntax would be the cleanest upgrade path for new devs; but might break the rest of thesocialize
packages.Maybe a global option also?
Then people could opt-in by default, and opt-out as needed; or vice-versa, and opt-out by default, and opt-in as needed.
Having this functionality will make it much easier to integrate the socialize package into existing apps!