[SERVER-1148] mongo return codes Created: 24/May/10  Updated: 29/May/10  Resolved: 28/May/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kenny Gorman Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

We are scripting deloy scripts using .js files and want to have them automatically run at deploy time. But we need a proper return code:

al01 /home/kgorman$ cat test.js | mongo
MongoDB shell version: 1.5.2-pre-
url: test
connecting to: test
type "help" for help
> use content
switched to db content
> fdkjfkdjfkdb.bookStyles.ensureIndex(

{"styleId":1,"sizeId":1,"version":1}

)
Mon May 24 16:32:33 JS Error: ReferenceError: fdkjfkdjfkdb is not defined (shell):0
>
> bye
al01 /home/kgorman$ echo $?
0



 Comments   
Comment by dan [ 29/May/10 ]

FWIW, I would be very interested in being able to specify exit codes for my shell scripts, not just for syntax errors in the supplied javascript, but for general user-specified failures. I suspect that's slight different than this ticket, although obviously related, so I've opened a ticket for it at http://jira.mongodb.org/browse/SERVER-1172

Comment by Eliot Horowitz (Inactive) [ 28/May/10 ]

the correct way to run scripts is
./mongo test.js

then return codes should work

when running in interactive mode, it behaves differently as you can continue after an error

Generated at Thu Feb 08 02:56:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.