<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:44 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-757] Overriding Collection Name in MongoDb</title>
                <link>https://jira.mongodb.org/browse/CSHARP-757</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I have a .Net object named CacheItem&amp;lt;T&amp;gt; that gets persisted to MongoDb. When the object gets persisted, the name of the collection becomes CacheItem`1. If I try to use and shell commands against that document I get &apos;javascript illegal&apos; error message due to the name that contains the tick mark, &apos;`&apos;. Is there a way to set the name of the object so that it isnt named as such?&lt;/p&gt;</description>
                <environment>Windows 2008, Windows 7</environment>
        <key id="78576">CSHARP-757</key>
            <summary>Overriding Collection Name in MongoDb</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="joetherod">joseph rodriguez</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Tue, 11 Jun 2013 13:21:53 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:23 +0000</updated>
                            <resolved>Tue, 11 Jun 2013 14:39:24 +0000</resolved>
                                    <version>1.8.1</version>
                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="357662" author="craiggwilson" created="Tue, 11 Jun 2013 14:39:24 +0000"  >&lt;p&gt;Joseph,&lt;br/&gt;
  Yes, you are right.  Your GetDocumentCollection&amp;lt;T&amp;gt; method is the one creating the collection name.  You&apos;ll need to figure out how to change that yourself.  One option would be to change any ` marks to an _, or something like that.  Alternatively, you could just drop anything starting at the ` mark.  However, that would create some collisions between, for instance, Tuple&amp;lt;T&amp;gt; and Tuple&amp;lt;T1, T2&amp;gt;.&lt;/p&gt;

&lt;p&gt;  Hope that helps.  I&apos;m going to close this ticket as works as designed.  Feel free to post back if you need some more help or clarification.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Craig&lt;/p&gt;</comment>
                            <comment id="357647" author="joetherod" created="Tue, 11 Jun 2013 14:26:40 +0000"  >&lt;p&gt;Here is my save method:&lt;/p&gt;

&lt;p&gt;        public void Add&amp;lt;T&amp;gt;(string key, T item, int expiryMinutes = 0)&lt;br/&gt;
        {&lt;br/&gt;
            if (_enableCache)&lt;br/&gt;
            {&lt;br/&gt;
                key = typeof (T).FullName + key;&lt;br/&gt;
                var collection = _client.GetDocumentCollection&amp;lt;CacheItem&amp;lt;T&amp;gt;&amp;gt;();&lt;br/&gt;
                var cacheItem = new CacheItem&amp;lt;T&amp;gt;&lt;br/&gt;
                    &lt;/p&gt;
{
                        CacheKey = key,
                        Expires = expiryMinutes == 0 ? DateTime.UtcNow.AddMinutes(_expiryMinutes) : DateTime.UtcNow.AddMinutes(expiryMinutes),
                        Item = item
                    }
&lt;p&gt;;&lt;/p&gt;

&lt;p&gt;                collection.Save(cacheItem);&lt;br/&gt;
            }&lt;br/&gt;
        }&lt;/p&gt;

&lt;p&gt;        public MongoCollection&amp;lt;T&amp;gt; GetDocumentCollection&amp;lt;T&amp;gt;()&lt;/p&gt;
        {
            return Database.GetCollection&amp;lt;T&amp;gt;(typeof(T).Name);
        }

&lt;p&gt;So my helper method is using the name of the object. Since the object is of generic type, that is where that name with the tick mark is coming from. I should provide an override to explicitly state the name of the object in this case.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                            <comment id="357610" author="rstam" created="Tue, 11 Jun 2013 13:55:25 +0000"  >&lt;p&gt;The driver does not set the name of the collection. The application code sets the name of the collection, using code something like this:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;MongoDatabase database;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var collection = database.GetCollection&amp;lt;CacheItem&amp;lt;T&amp;gt;&amp;gt;(&quot;cacheitems&quot;);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Can you provide some sample code where you are calling GetCollection?&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|hrr2tj:</customfieldvalue>

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