<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:08:03 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-5154] Shell script should be able to receive command line arguments</title>
                <link>https://jira.mongodb.org/browse/SERVER-5154</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;It should be possible to run&lt;/p&gt;

&lt;p&gt;./mongo dbname myscript.js --myarg value &lt;/p&gt;

&lt;p&gt;where myarg would be passed to myscript as a command line argument. &lt;/p&gt;</description>
                <environment>All</environment>
        <key id="31920">SERVER-5154</key>
            <summary>Shell script should be able to receive command line arguments</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="12300">Won&apos;t Do</resolution>
                                        <assignee username="geert.bosch@mongodb.com">Geert Bosch</assignee>
                                    <reporter username="srimonti">Srimonti Karmakar</reporter>
                        <labels>
                    </labels>
                <created>Thu, 1 Mar 2012 13:58:15 +0000</created>
                <updated>Mon, 25 Oct 2021 12:37:27 +0000</updated>
                            <resolved>Mon, 25 Oct 2021 12:37:23 +0000</resolved>
                                    <version>2.1.0</version>
                                    <fixVersion>features we&amp;#39;re not sure of</fixVersion>
                                    <component>Shell</component>
                                        <votes>5</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="95005" author="srimonti" created="Sat, 3 Mar 2012 20:38:54 +0000"  >&lt;p&gt;The feature request suggests use of ordering to distinguish between arguments to be passed to the script versus options set for the shell.&lt;/p&gt;

&lt;p&gt;Since the structure is &lt;br/&gt;
./mongo &lt;span class=&quot;error&quot;&gt;&amp;#91;server:port/dbname&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;options&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;myscript.js&amp;#93;&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;adding args for the script through&lt;br/&gt;
./mongo &lt;span class=&quot;error&quot;&gt;&amp;#91;server:port/dbname&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;options&amp;#93;&lt;/span&gt; [myscript.js &lt;span class=&quot;error&quot;&gt;&amp;#91;my_args&amp;#93;&lt;/span&gt;]&lt;/p&gt;


&lt;p&gt;should able to detect correct vs incorrect&lt;/p&gt;

&lt;p&gt;$ ./mongo --host myDataBaseHost foo.js #correct&lt;br/&gt;
$ ./mongo foo.js --hots                #correct (as far as shell is concerned, script may report error)&lt;br/&gt;
$ ./mongo --hots myDataBaseHost foo.js #incorrect&lt;/p&gt;
</comment>
                            <comment id="94563" author="schwerin" created="Fri, 2 Mar 2012 12:09:09 +0000"  >&lt;p&gt;A typical approach to the &quot;duped parameter names&quot; problem on *nix systems is to make use of ordering.  Arguments before the script go to the interpreter, and those after go to the script&apos;s own &quot;ARGV&quot; array, or equivalent.&lt;/p&gt;</comment>
                            <comment id="94556" author="tad" created="Fri, 2 Mar 2012 11:36:16 +0000"  >&lt;p&gt;Discussed in &lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/fa93bb09e73a4a37&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/fa93bb09e73a4a37&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My comment:&lt;br/&gt;
Another workaround is to combine --eval with your JavaScript file on the command line, for example: &lt;br/&gt;
$ cat addthem.js &lt;br/&gt;
printjson( param1 + param2 ); &lt;br/&gt;
$ ./mongo --nodb --quiet --eval &quot;var param1=7, param2=8&quot; addthem.js &lt;br/&gt;
15 &lt;/p&gt;

&lt;p&gt;If the intent is that --myarg is the parameter name, then this would be hard to do this way without losing the ability to reject invalid command line arguments.&lt;/p&gt;

&lt;p&gt;$ ./mongo --host myDataBaseHost foo.js # connect to host myDataBaseHost&lt;br/&gt;
$ ./mongo --hots myDataBaseHost foo.js # pass &quot;hots&quot; parameter to script?&lt;/p&gt;

&lt;p&gt;We also have the risk of breaking existing parameter-passing command lines if we introduce a new command line option.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 2 Mar 2012 11:36:16 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 50 weeks, 4 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>geert.bosch@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 50 weeks, 4 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>geert.bosch@mongodb.com</customfieldvalue>
            <customfieldvalue>srimonti</customfieldvalue>
            <customfieldvalue>tad</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrobev:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr9j9r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5965</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrqrkf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>