kitchen-site
kitchen-site copied to clipboard
Error while using generic joins for self joins (using intermediate collection)
Petar,
Thanks for all the work in meteor-kitchen. It is an extremely well thought out code generator. I am trying to write most of the code in the meteorkitchen for easy maintainability and pretty much getting everything that I have a need for supported so far. I had a use case for generic joins and was quite delighted to find that generic joins are supported directly.
I have noticed an issue while using generic joins to create self joins. I use an intermediate collection for this and specify both left and right collections and their primary keys in each document. It is working perfectly fine except when I use it to create a join with the same collection. e.g. left collection = right collection (with different ids for the test case). In this case I get this error at server
Exception from sub <query name> id <some id> Error: Publish function returned multiple cursors for collection <right collection>.
I am new to meteor and haven't yet figured out how to display an object or cursor at the server end so I did not debug much as to which cursors are being returned. I think it would be trivial to do that. It is this method
Workaround : I just used "mrt:smart-publish" package. It works fine. But I have to override the meteorkitchen code for this.
Hi @paplet , perak:joins ppackage is written in rush and I am currently working on a new kitchen-GUI (in the same time improving kitchen-CLI), so I'll need to replace perak:joins with something else (or improve it to be bug-free and useful). It will be solved soon (in next 2-3 weeks). Until then... what to say... use "tricks" if you can.
Thanks @perak, its not a show stopper and the workaround is working perfectly. Thanks again for your help. Just a question, I am using only the kitchen-CLI and have never used the GUI. So should I post any issues/feature requests in this repository or the CLI?
This repository is fine. :+1:
This fork https://github.com/ljack/meteor-joins/tree/patch-1 or this (https://github.com/ljack/meteor-joins/tree/master can't rememebr fix branch it was, I think it's the master branch ;) fixes perak:joins to support multiple cursors for the same collection. I've used it successfully.
@ljack , Sorry for my ignorance, but I have no idea how I can use the patch. I downloaded the zip file, can you help where do I go from here? Thanks.
You need to install it as meteor local package. Basically: (from https://dweldon.silvrback.com/local-packages and memory)
cd your-meteor-project
mkdir packages
cd packages
git clone https://github.com/ljack/meteor-joins.git (or maybe unzip here?)
should do it. If not make sure that the correct version of perak:joins is installed and the environment variable PACKAGE_DIRS
points to the packages
dir (if needed). You can check in your-meteor-project/.meteor/versions/
the version of perak:joins your project is using.
Edit: changed suggested folder name for the folder is packages
so meteor should search there first by default.
After I merge this, you'll be able to use it as normal package, but I need to find some time to test PR first...