[enhancement] make "Collection" field optional in query
Hi,
My problem is if I want to create cutom publish, I need to edit them in the JSON editor rather than left the Collection field blank.
It is not even possible, kitchen complains that the collection does not exists if I do that and stop generating.
@perak could you think about making this optional even for generation ?
Makes sense! I'll do it.
On Thursday, 14 July 2016, libre [email protected] wrote:
It is not even possible, kitchen complains that the collection does not exists if I do that and stop generating.
@perak https://github.com/perak could you think about making this optional even for generation ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/perak/kitchen-site/issues/320#issuecomment-232508927, or mute the thread https://github.com/notifications/unsubscribe/AFXrXkrZoxzLeXcBG3OQ1z8Gidngo5zZks5qVWqYgaJpZM4JH_Jr .
@perak for now I'll use a special collection named "CustomQueries" and then overwrite the publish file in server/publish after generator ran.
Hum... what if you provide publication via "copy_files"?
Ha my solution is not even working because the component tries to find a cursor in CustomQueries collection which is empty because it does not exists.
What do you mean ? If I had another publish file with the publication ? Meteor just ignore the second one in the case. Maybe if I had it before the generated file it could work. I will try it now.
"copy_files" executes last - after everything is generated, so you can overwrite original publication.
Ok, if I name a query "todo_models_with_percent_active" linked to the "TodoModels" collection, I can copy a file called 0_todo_models_with_percent_active.js in server/publish with the custom publication inside.
The publication generated in the todo_models.js file will be ignored by meteor and the custom will be used.
Ho didn't know that exists. Maybe cleaner than my solution :p
This is still a hack... so requires better more universal and long-term solution.
Yes, it is listed in the "hacks" section of my readme :)
What kind of hackers we will be if we don't make hacks? :)
right !