<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:37 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>[CSHARP-1440] Is there option to run javascript from c# except eval</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1440</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;Is there other option to run javascript which might contains multiple mapreduce? and return list of bsondocument ?&lt;/p&gt;

&lt;p&gt;I tried eval to run but through error and showing map reduce not supported in eval.&lt;/p&gt;

&lt;p&gt;I want to run following script from c# and get result.&lt;/p&gt;


&lt;p&gt;------------------------------&lt;br/&gt;
db.services_providers.drop();&lt;br/&gt;
var servicemap = function (){&lt;br/&gt;
    emit(this._id,&lt;/p&gt;
{providers:[],serviceName:this.serviceName}
&lt;p&gt;)&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;var serviceProviderMap = function(){&lt;br/&gt;
    var self=this;&lt;br/&gt;
   this.services.forEach(function(data){&lt;br/&gt;
        var p= new Array();&lt;br/&gt;
        p.push(&lt;/p&gt;
{providerName:self.providerName,providerID:self._id}
&lt;p&gt;)&lt;br/&gt;
        emit(data,&lt;/p&gt;
{providers:p,serviceName:null}
&lt;p&gt;);&lt;br/&gt;
   });&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;var r = function(key, values){  &lt;br/&gt;
    var result=&lt;/p&gt;
{
            serviceName:&quot;&quot;,
            providers:[]
        }
&lt;p&gt;    values.forEach(function(value) {&lt;br/&gt;
        if(value.serviceName!=null)&lt;/p&gt;
{
            result.serviceName=value.serviceName
        }
&lt;p&gt;        if(value.providers!=null )&lt;/p&gt;
{
             result.providers = result.providers.concat(value.providers);
        }
&lt;p&gt;    });&lt;br/&gt;
    return result;&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;var a=db.services.mapReduce(servicemap, r, {out: {reduce : &apos;services_providers&apos;}});&lt;/p&gt;

&lt;p&gt;var b =db.serviceProviders.mapReduce(serviceProviderMap, r, {out: {reduce : &apos;services_providers&apos;}});&lt;/p&gt;


&lt;p&gt;db.services_providers.aggregate([&lt;br/&gt;
    &lt;/p&gt;
{
        &quot;$unwind&quot;:&quot;$value.providers&quot;
    }
&lt;p&gt;,&lt;br/&gt;
    {&lt;br/&gt;
        &apos;$project&apos;:&lt;/p&gt;
{
             &apos;_id&apos;:0,
            &apos;serviceID&apos;:&apos;$_id&apos;,
            &apos;serviceName&apos;:&apos;$value.serviceName&apos;,
            &apos;providerName&apos;:&apos;$value.providers.providerName&apos;,
            &apos;providerID&apos;:&apos;$value.providers.providerID&apos;
        }
&lt;p&gt;        &lt;br/&gt;
    }&lt;br/&gt;
]);&lt;/p&gt;

&lt;p&gt;------------------------------------&lt;/p&gt;

&lt;p&gt;this script run properly in mongo command prompt. and showing result.&lt;/p&gt;







</description>
                <environment></environment>
        <key id="233508">CSHARP-1440</key>
            <summary>Is there option to run javascript from c# except eval</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="rajesh19999">rajesh</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Thu, 8 Oct 2015 11:24:32 +0000</created>
                <updated>Fri, 5 Apr 2019 13:59:36 +0000</updated>
                            <resolved>Thu, 8 Oct 2015 11:42:10 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1055155" author="craiggwilson" created="Thu, 8 Oct 2015 11:42:03 +0000"  >&lt;p&gt;Hi Rajesh,&lt;/p&gt;

&lt;p&gt;The MongoDB user group is a much better place to ask these types of questions: &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!forum/mongodb-user&lt;/a&gt;. We use JIRA for bug tracking and feature requests.&lt;/p&gt;

&lt;p&gt;To answer your question, no. The .NET driver cannot be used to run shell commands. You&apos;ll need to rewrite your script to use the .NET driver.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsdl8n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>