<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:52 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-801] IIdGenerator.GenerateId gives &quot;InsertOpreration&quot; instead of &quot;MongoCollection&quot; for the &quot;container&quot; paramter in 1.8.2</title>
                <link>https://jira.mongodb.org/browse/CSHARP-801</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;After updating to version 1.8.2 our custom id generator came crashing down. The &quot;container&quot; parameter of IIdGenerator.GenerateId used to be a MongoCollection instance but now seems to be an InsertOperation whatever that is, the class is internal so there is really no way to use it for anything.&lt;/p&gt;

&lt;p&gt;I could not find anything in the release notes and documentation or issues here on Jira to hint at a change. We downgraded to 1.8.1 and it works.&lt;/p&gt;

&lt;p&gt;I have attached a small test project that for me shows the error.&lt;/p&gt;</description>
                <environment></environment>
        <key id="85724">CSHARP-801</key>
            <summary>IIdGenerator.GenerateId gives &quot;InsertOpreration&quot; instead of &quot;MongoCollection&quot; for the &quot;container&quot; paramter in 1.8.2</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="christian@sparre.it">Christian Sparre</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Aug 2013 10:01:05 +0000</created>
                <updated>Tue, 25 Aug 2015 14:18:06 +0000</updated>
                            <resolved>Mon, 26 Aug 2013 15:48:05 +0000</resolved>
                                    <version>1.8.2</version>
                                    <fixVersion>1.8.3</fixVersion>
                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1013851" author="xgen-internal-githook" created="Tue, 25 Aug 2015 14:18:06 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-801&quot; title=&quot;IIdGenerator.GenerateId gives &amp;quot;InsertOpreration&amp;quot; instead of &amp;quot;MongoCollection&amp;quot; for the &amp;quot;container&amp;quot; paramter in 1.8.2&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-801&quot;&gt;&lt;del&gt;CSHARP-801&lt;/del&gt;&lt;/a&gt;: The container parameter to GenerateId should be a MongoCollection (not an InsertOperation).&lt;br/&gt;
Branch: v1.8.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/0bcca2e5abae5e7d26807bafc2c079ce5667c744&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/0bcca2e5abae5e7d26807bafc2c079ce5667c744&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="431093" author="auto" created="Wed, 25 Sep 2013 14:56:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-801&quot; title=&quot;IIdGenerator.GenerateId gives &amp;quot;InsertOpreration&amp;quot; instead of &amp;quot;MongoCollection&amp;quot; for the &amp;quot;container&amp;quot; paramter in 1.8.2&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-801&quot;&gt;&lt;del&gt;CSHARP-801&lt;/del&gt;&lt;/a&gt;: The container parameter to GenerateId should be a MongoCollection (not an InsertOperation).&lt;br/&gt;
Branch: v1.8.3&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/0bcca2e5abae5e7d26807bafc2c079ce5667c744&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/0bcca2e5abae5e7d26807bafc2c079ce5667c744&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="411490" author="auto" created="Mon, 26 Aug 2013 15:47:31 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-801&quot; title=&quot;IIdGenerator.GenerateId gives &amp;quot;InsertOpreration&amp;quot; instead of &amp;quot;MongoCollection&amp;quot; for the &amp;quot;container&amp;quot; paramter in 1.8.2&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-801&quot;&gt;&lt;del&gt;CSHARP-801&lt;/del&gt;&lt;/a&gt;: The container parameter to GenerateId should be a MongoCollection (not an InsertOperation).&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/3407deaa73005a656c8b29188a6b13dac0bf473a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/3407deaa73005a656c8b29188a6b13dac0bf473a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="409705" author="rstam" created="Fri, 23 Aug 2013 05:05:51 +0000"  >&lt;p&gt;Fix is in code review.&lt;/p&gt;</comment>
                            <comment id="406447" author="craiggwilson" created="Mon, 19 Aug 2013 16:51:11 +0000"  >&lt;p&gt;No, it&apos;s just an inconsistency.  This slipped by and was unintended.&lt;/p&gt;</comment>
                            <comment id="406104" author="attilah" created="Mon, 19 Aug 2013 08:40:36 +0000"  >&lt;p&gt;Is that normal that for a .Save operation on the collection the IdGenerator gets MongoCollection in context, for .Insert and .InsertBatch it receives an InsertOperation instance in the same variable?&lt;/p&gt;</comment>
                            <comment id="405829" author="craiggwilson" created="Sun, 18 Aug 2013 21:21:39 +0000"  >&lt;p&gt;Not a hack for that one.  I think you can probably just use the database name and create a new MongoClient and get the database off of it.  Sorry &apos;bout this.  We are trying to figure out the best way to handle this given the refactoring.&lt;/p&gt;</comment>
                            <comment id="405380" author="attilah" created="Sat, 17 Aug 2013 17:03:32 +0000"  >&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;I also hit this issue. I&apos;ve to generate sequential integer IDs. From GenerateId method I need to access the Database instance to get hold of the &quot;IDs&quot; collection.&lt;/p&gt;

&lt;p&gt;Is there a hack for that too? &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Attila&lt;/p&gt;</comment>
                            <comment id="401885" author="craiggwilson" created="Tue, 13 Aug 2013 13:21:12 +0000"  >&lt;p&gt;Ok, until we can come up with a solution, I have a hack for you.  If all you need is the database name and the collection name, you can use reflection to get it.  Let me know if this is enough for now and we&apos;ll work on getting a proper fix in our next release.&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;public object GenerateId(object container, object document)&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;   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;{&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;   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 type = container.GetType();&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;   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 databaseName = type.GetProperty(&quot;DatabaseName&quot;, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(container, null);&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;   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 collectionName = type.GetProperty(&quot;CollectionName&quot;, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(container, null);&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&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;   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;    ...&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;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                            <comment id="401863" author="christian@sparre.it" created="Tue, 13 Aug 2013 12:46:54 +0000"  >&lt;p&gt;Hi Craig&lt;/p&gt;

&lt;p&gt;Just went through the code of our id generator and we actually do not use the MongoCollection directly, but we use the name and a reference to the MongoDatabase instance.&lt;/p&gt;

&lt;p&gt;It&apos;s a HiLo kind of id generator where each application instance gets a batch of ids.&lt;/p&gt;

&lt;p&gt;So a solution where we can access the Database instance/name and the collectionname would be enough in our case.&lt;/p&gt;

&lt;p&gt;The InsertOperation does seem to have the databaseName and collectionName information so a solution should be possible.&lt;/p&gt;</comment>
                            <comment id="401856" author="craiggwilson" created="Tue, 13 Aug 2013 12:35:36 +0000"  >&lt;p&gt;Thanks for the report and sorry about the issues.  As we no longer have access to MongoCollection, we&apos;re going to have to figure something out.  Could you tell us what you are using the MongoCollection for in your IdGenerator so we can come up with something to use in it&apos;s place?&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="401786" author="christian@sparre.it" created="Tue, 13 Aug 2013 10:17:16 +0000"  >&lt;p&gt;After looking a bit at the code on GitHub I think it might have happened with this commit &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/f61f965cc1e741d39bda247dfdf2445c2000ffed&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/f61f965cc1e741d39bda247dfdf2445c2000ffed&lt;/a&gt; where Robert seems to have moved some code from MongoCollection to a number of &quot;operations&quot; &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="29816" name="GenerateIdBug.zip" size="2931044" author="christian@sparre.it" created="Tue, 13 Aug 2013 10:01:05 +0000"/>
                    </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|hrs7j3:</customfieldvalue>

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