meteor-collection-hooks
meteor-collection-hooks copied to clipboard
Specify which fields of a document to pull into the before/after update hooks
This PR makes two changes:
- A bug fix: If you define any after hooks, the before hook will fetch the previous document, even if
fetchPreviousis set to false. - A new feature allowing you to specify which fields of a document should be pulled in if
fetchPreviousis true
for (2) you can either specify the fields as globals or on a specific aspect as follows:
Collection.hookOptions.after.update = { fetchFields: { _id: 1, field1: 1, field2: 1, field3: 1 } };
By default you get all fields (so the default behaviour has not changed)
The tests all pass, however another set of eyes would be useful!
@znewsham Hello and thank you for your contribution! I have merged modernization PR so there will be some conflicts, but those should be easy to resolve.
I've manually fixed the conflicts for this, but we now have failing tests due to the absence of jQuery in 1.8.3. Is there a way to configure which npm packages are installed before tests are run?
Yes, you can use the --test-app-path ./path/to/test-app argument to a directory containing a package.json file.
Here's an example how we did it for blaze https://github.com/meteor/blaze/commit/f13c2ad979fb56cd3160f105eb5b9a7d61b8ef43
Awesome, thanks @sebakerckhof
@StorytellerCZ could you take a look at the failing tests and see if you can get them to pass? I've not been able to manage it.
@copleykj I'll see if I can get some time on this over the weekend.
@copleykj Looks like an issue with spacejam, when running tiny test on its own the test pass.