Closed ChristopherBiscardi closed 12 years ago
Everything you have here looks ok. It's possible something is timing out or not connecting properly (how are you determining that?). This is a good candidate for GH-85.
I'm currently checking the mongod
log output as the script is run. Connection seems to be established, query never hits the database.
Agreed, I'll play around with #85 tomorrow.
I've found some interesting code.
It seems to run through the library until it hits this line of code. I can find an _authorizeQueue variable in one other function but It sets the var to [] at the beginning of the function.
this._authorizeQueue.push([command,callback])
and a contrived stack trace on the line above the above function:
Error
at [object Object].sendCommand (/Users/chris/Desktop/test/db_test/node-mongolian/lib/db.js:87:21)
at [object Object].nextBatch (/Users/chris/Desktop/test/db_test/node-mongolian/lib/cursor.js:140:17)
at [object Object].toArray (/Users/chris/Desktop/test/db_test/node-mongolian/lib/cursor.js:215:14)
It would seem that the command never gets sent and instead ends it's life in an array that never gets used at db.js:87
Commit 767d7b8a70e01b966256e8ee0f6c7742061833e5 is where this code was introduced
I plugged in this code just underneath the _authorizeQueue
this.server.sendCommand(command,callback); //calling send in server.js:247
and this error pops up:
[warn] Authentication failed for `username-redacted` @ Mongolian
Fixed the issue.
Ends up mongod was running without --auth and we were trying to authenticate against it with a username and pw that were in the users collection.
Running mongod --auth fixed the issue.
This code works on my local computer. I can successfully connect to a remote database server and return an array of matches. When I upload the same exact code to the app server, The connection to the database server is successful, however, the .find() doesn't fire. In another case the the same find function returns an empty array on the server (The find() function works fine when running on my local computer with a remote database).
Am I missing something obvious here?