-
Notifications
You must be signed in to change notification settings - Fork 50
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
"Error: callback is not a function!" when trying to call findOne(...) #52
Comments
Curious... I wonder if somehow For kicks, what happens if you change cursor.js:153 to:
|
Hi, thanks for looking into this! I tried changing that line, and still got the same error. It seems that "callback" is "undefined" at that point (according to console.log) -- and yeah, I wasn't doing anything funky with contexts, etc; I've copied the terminal session from clean install of mongolian (+ dependencies) through to running those 5 lines of code that give the error (see below). Strangely, if I pass "console.log" directly as the callback function, it works, but any combination of my own anonymous/non-anonymous functions (with 0 to 3 parameters) fails to work -- "callback" is undefined already as soon as it gets into "[object Object].findOne (./node_modules/mongolian/lib/collection.js)". Not sure if there's some other middleware hooking it and removing it before it gets there?
|
I wonder if this is a limitation of running the REPL (it definitely does funky Context stuff). Does the same thing happen if you make a temp.js file and run |
Interesting! It works if I run it non-interactively, as you predict, yes. Does this happen for you too (in the REPL), or is it something peculiar about my configuration? I'm typically able to pass callbacks to functions in the REPL, so I'm curious about what's going on here. Thanks for your work on this module, and let me know if I can help debug this in any way, as I like the approach you're taking, and would be happy to see this package mature. |
It does happen for me, too. I did some digging and it is a result of the REPL instance of I can use |
When I try to do a simple query on a collection, such as:
I get the error:
It does the same thing no matter where I put the callback function (1st, 2nd, or 3rd argument). I also get the same error when I try to run the findOne code from the main example. The find() code seems to work, though I too get a stack overflow (as others reported) when doing a forEach on a large cursor.
I'm using node v0.4.11, and mongolian 0.1.10 (the one npm just installed), on 64bit Ubuntu 11.04. Thanks!
The text was updated successfully, but these errors were encountered: