Skip to content
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

Manage the sutdown command. #93

Merged
merged 1 commit into from
Sep 18, 2013
Merged

Manage the sutdown command. #93

merged 1 commit into from
Sep 18, 2013

Conversation

sorribas
Copy link
Collaborator

This manages the shutdown command so mongojs doesn't crash when it is executed. I couldn't really find a way to test this, since doing so would shutdown the mongodb daemon. Creating mock functions is a possibility but I don't know if it is worth it, being this such an uncommon use case. What do you think?

@mafintosh
Copy link
Collaborator

Looks good. I agree with you that mocks aren't worth it so lets just leave this untested for now.

mafintosh added a commit that referenced this pull request Sep 18, 2013
Manage the sutdown command.
@mafintosh mafintosh merged commit b8283ff into mongo-js:master Sep 18, 2013
@sorribas
Copy link
Collaborator Author

Great. Also forgot to say this fixes #92.

@mafintosh
Copy link
Collaborator

Published as 0.9.5

@bugs181
Copy link

bugs181 commented Sep 22, 2013

Has anyone actually tested this? I still get the error and have updated to 0.9.5

Code: db_exit.js

var mongojs = require("mongojs");
var db = mongojs('admin');
db.runCommand({shutdown : 1});

Error:

levis-mac-pro:server levi$ node db_exit

events.js:72
        throw er; // Unhandled 'error' event
          ^
Error: failed to connect to [127.0.0.1:27017]
    at null.<anonymous>     (/Users/levi/Projects/node_modules/mongojs/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
    at EventEmitter.emit (events.js:106:17)
    at null.<anonymous>     (/Users/levi/Projects/node_modules/mongojs/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
    at EventEmitter.emit (events.js:98:17)
    at Socket.<anonymous>     (/Users/levi/Projects/node_modules/mongojs/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)

mafintosh added a commit that referenced this pull request Sep 22, 2013
@mafintosh
Copy link
Collaborator

That's my bad. Had my mongo running with upstart so it came back up after shutting down. Should be working now in 0.9.6

@bugs181
Copy link

bugs181 commented Sep 22, 2013

Perfect! Works great now. Thanks.

@mderazon mderazon mentioned this pull request Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants