-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Options on insert #233
Comments
This package doesn't work or doesn't work properly with Meteor 1.6+ |
Damn, this is unfortunate. Is there a Meteor version you recommend to use in the meantime with this package? It's essential to a our codebase so getting rid of it isn't an option at the moment. |
Version previous to Meteor 1.6.1 "should" work. |
I am currently running 1.6.0.1 |
I'll need a repoduction repo to be able to help you with this. I need to see the problem and be able to follow the code down to Meteor's mongo/mini mongo collection level. I'm spread quite thin currently so I can't say when I'll have time to look at this. |
Gotcha, I totally understand. I'll post back once I get a repo up, and I'll do some more digging as well. |
Here is the link to the test repo. It's very simple, you have two buttons, one inserts into DB without options the other with options, and when you insert with options, you will see a error in the console that "callback is not a function". I haven't been able to deduce the issue yet, but maybe I will find something this weekend with the free time. |
Just a thought, wondering why we are getting the error in the first place with the package. Example if I extend the mongo collection, I can pass options to the hook, but don't need to pass those options to the actual insert, example below . And all works.
Is there a reason why in "insert" hooks isn't getting my options parameter in the first place? I can pass it to the hook, but I would remove it before the actual insert. Just wondering why I am not seeing it in the first place. If you look at the console, the options never get to the function itself. Any ideas what could be causing that?
|
I looked at the code once more of your "own" version and the problem is that you don't strip out the "optional" |
I attached the insert.js file, on how I used to do it before 1.6, and in that one I did remove the options. What confused me now is the options are never passed to the function in the first place, so there is nothing to strip out.
|
So I setup another repo running 1.2.1, and did a side by side test. Also I put a bunch of logs in the main function to follow the execution path. Not being to familiar with the code, this helped me understand it more. And the arguments that this main function gets never even gets the options to pass on. Below is the main functions with all the logs shown.
1.6 Look at the parameters that are called "PAR 1, PAR 2... etc" In 1.6 you get the object, and a callback function right away.
1.2.1 and hooks package 0.8.1 (newest version has dependencies not compatible with 1.2.1)
Also link to second repo in case you want it. Not sure where I can go next to debug why the second parameter in 1.6 is a function. |
I was using this package at version 0.8.1 with Meteor 1.2, I also changed the package locally to have the ability to have an options parameter for insert and remove hooks.
All was good, then I upgraded Meteor to 1.6 along with this package to version 0.9.0-rc.4, and wanted to have the same options as before on insert and remove hooks.
Now I am getting errors whenever I try
Collection.insert(object, {exampleOption: "something"});
And the error is always
callback is not a function
I went back to an older version I had used before to 0.8.1 and the same error happens.
The other issue I am having is options are not passed to the package at all. I have my code below and console results.
At this point I am wondering if Meteor changed something that is causing the root of the problem, any help would be appreciated, thanks!
insert.js of collection hooks.
Console result
Also to note, I renamed the package to "old:collection-hooks" just because I have it locally and it was the older version, that's why is coming up as "packages/old_collection-hooks.js"
The text was updated successfully, but these errors were encountered: