We have a simple MongoShell working at the moment, but I cannot do something like the one shown below:
mongo> var cat = 0, dog = 1;
mongo> print(cat, dog);
0 1
mongo> cat = cat + 1;
cat: cannot access '=': No such file or directory
cat: cannot access 'cat': No such file or directory
cat: cannot access '+': No such file or directory
cat: cannot access '1': No such file or directory
mongo> \catt file
catt: command not found
mongo>
because the third statement, 'cat = cat + 1;', is interpreted as a FluidShell command.
I need to review current ADS implementation to ensure user's input is interpreted correctly in MongoShell.
Assumption: a fluid command should be prefixed with \ when executed in MongoShell
Based on the assumption above, made the following changes (SVN r32583, 14.0.0-alpha-24):
(1) Change the default of CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD shell variable from true to false:
so that 'cat' won't be interpreted as '\cat'.
(2) Change the default of CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION shell variable from true to false:
so that alias expansion will NOT be applied to the first word on the command line if that word is NOT prefixed with \ character.
Assumption: ADS will not allow user to switch FluidShell to/from MongoShell
If assumption above is correct, we might want to review the list of shell variables currently created in FluidShell and MongoShell:
FluidShell:
prompt> set
* CLI_SHELL_LINE_EXECUTE_JAVASCRIPT_IMMEDIATELY=false
* CLI_SHELL_LINE_EXECUTE_SQL_AS_JAVASCRIPT=false
CLI_SHELL_LINE_INTERPRETER_ERROR_ON_EXPLICIT_CMD_NOT_FOUND=true
CLI_SHELL_LINE_INTERPRETER_EVAL_COMMENT=sql
CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_CMD=true
CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_SQL=false
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY=true
CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD=true
CLI_SHELL_LINE_INTERPRETER_EXPLICIT_CMD_CHAR=\
CLI_SHELL_LINE_INTERPRETER_EXPLICIT_SQL_CHAR=;
CLI_SHELL_LINE_INTERPRETER_IMPLICIT_BEHAVIOR=sql
CLI_SHELL_LINE_INTERPRETER_IS_AT_SIGN_GO=true
CLI_SHELL_LINE_INTERPRETER_IS_FORWARDSLASH_GO=true
CLI_SHELL_LINE_INTERPRETER_IS_SEMICOLON_GO=false
CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION=true
* CLI_SHELL_LINE_JAVASCRIPT_API=aqua
If a FluidShell cannot be switched to a MongoShell, why we want to create javascript specific variables (marked with *) in FluidShell?
MongoShell:
prompt> \set
CLI_SHELL_LINE_EXECUTE_JAVASCRIPT_IMMEDIATELY=true
CLI_SHELL_LINE_EXECUTE_SQL_AS_JAVASCRIPT=true
CLI_SHELL_LINE_INTERPRETER_ERROR_ON_EXPLICIT_CMD_NOT_FOUND=true
? CLI_SHELL_LINE_INTERPRETER_EVAL_COMMENT=sql
CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_CMD=true
* CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_SQL=false
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY=true
CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD=false
CLI_SHELL_LINE_INTERPRETER_EXPLICIT_CMD_CHAR=\
* CLI_SHELL_LINE_INTERPRETER_EXPLICIT_SQL_CHAR=;
? CLI_SHELL_LINE_INTERPRETER_IMPLICIT_BEHAVIOR=sql
* CLI_SHELL_LINE_INTERPRETER_IS_AT_SIGN_GO=false
* CLI_SHELL_LINE_INTERPRETER_IS_FORWARDSLASH_GO=false
* CLI_SHELL_LINE_INTERPRETER_IS_SEMICOLON_GO=true
CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION=false
CLI_SHELL_LINE_JAVASCRIPT_API=mongo
If a MongoShell cannot be switched to a FluidShell, why SQL specific variables (marked with *) are presented in MongoShell? And, some of variables (marked with ?) probably do not apply, either (e.g. comments will always be evaluated in javascript style, and implicit behavior is always javascript).
Assumption: ADS will not allow user to switch FluidShell to/from MongoShell
If assumption above is correct, we might want to review the list of shell variables currently created in FluidShell and MongoShell:
FluidShell:
prompt> set
* CLI_SHELL_LINE_EXECUTE_JAVASCRIPT_IMMEDIATELY=false
* CLI_SHELL_LINE_EXECUTE_SQL_AS_JAVASCRIPT=false
CLI_SHELL_LINE_INTERPRETER_ERROR_ON_EXPLICIT_CMD_NOT_FOUND=true
CLI_SHELL_LINE_INTERPRETER_EVAL_COMMENT=sql
CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_CMD=true
CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_SQL=false
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY=true
CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD=true
CLI_SHELL_LINE_INTERPRETER_EXPLICIT_CMD_CHAR=\
CLI_SHELL_LINE_INTERPRETER_EXPLICIT_SQL_CHAR=;
CLI_SHELL_LINE_INTERPRETER_IMPLICIT_BEHAVIOR=sql
CLI_SHELL_LINE_INTERPRETER_IS_AT_SIGN_GO=true
CLI_SHELL_LINE_INTERPRETER_IS_FORWARDSLASH_GO=true
CLI_SHELL_LINE_INTERPRETER_IS_SEMICOLON_GO=false
CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION=true
* CLI_SHELL_LINE_JAVASCRIPT_API=aqua
If a FluidShell cannot be switched to a MongoShell, why we want to create javascript specific variables (marked with *) in FluidShell?
MongoShell:
prompt> \set
CLI_SHELL_LINE_EXECUTE_JAVASCRIPT_IMMEDIATELY=true
CLI_SHELL_LINE_EXECUTE_SQL_AS_JAVASCRIPT=true
CLI_SHELL_LINE_INTERPRETER_ERROR_ON_EXPLICIT_CMD_NOT_FOUND=true
? CLI_SHELL_LINE_INTERPRETER_EVAL_COMMENT=sql
CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_CMD=true
* CLI_SHELL_LINE_INTERPRETER_EVAL_EXPLICIT_SQL=false
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY=true
CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD=false
CLI_SHELL_LINE_INTERPRETER_EXPLICIT_CMD_CHAR=\
* CLI_SHELL_LINE_INTERPRETER_EXPLICIT_SQL_CHAR=;
? CLI_SHELL_LINE_INTERPRETER_IMPLICIT_BEHAVIOR=sql
* CLI_SHELL_LINE_INTERPRETER_IS_AT_SIGN_GO=false
* CLI_SHELL_LINE_INTERPRETER_IS_FORWARDSLASH_GO=false
* CLI_SHELL_LINE_INTERPRETER_IS_SEMICOLON_GO=true
CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION=false
CLI_SHELL_LINE_JAVASCRIPT_API=mongo
If a MongoShell cannot be switched to a FluidShell, why SQL specific variables (marked with *) are presented in MongoShell? And, some of variables (marked with ?) probably do not apply, either (e.g. comments will always be evaluated in javascript style, and implicit behavior is always javascript).
The problem described by this issue was fixed on 5/25/13, 14.0.0-alpha-24. For list of shell variables, it seems that Niels prefers to keeping the way it is for now.
The problem described by this issue was fixed on 5/25/13, 14.0.0-alpha-24. For list of shell variables, it seems that Niels prefers to keeping the way it is for now.
Issue #9145 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build 14.0.0-alpha-24 |
No time estimate |
3 issue links |
relates to #8994
Issue #8994We need to define the default Aliases for the MongoShell |
relates to #9237
Issue #9237; gives Exception occured with null message in ADS MongoShell |
relates to #8962
Issue #8962Enhance FluidShell to support CLI JavaScript and CLI MongoShell |
Assumption: a fluid command should be prefixed with \ when executed in MongoShell
Based on the assumption above, made the following changes (SVN r32583, 14.0.0-alpha-24):
(1) Change the default of CLI_SHELL_LINE_INTERPRETER_EVAL_IMPLICIT_CMD shell variable from true to false:
so that 'cat' won't be interpreted as '\cat'.
(2) Change the default of CLI_SHELL_LINE_INTERPRETER_PERFORM_ALIAS_EXPANSION shell variable from true to false:
so that alias expansion will NOT be applied to the first word on the command line if that word is NOT prefixed with \ character.