<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:45:54 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-3653] Cannot deserialize a &apos;String&apos; from BsonType &apos;ObjectId&apos;</title>
                <link>https://jira.mongodb.org/browse/CSHARP-3653</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The first example from MongoDB documentation is not working.&lt;/p&gt;

&lt;p&gt;Here is the structure of my document:&lt;/p&gt;

&lt;p&gt;_id: ObjectId;&lt;/p&gt;

&lt;p&gt;is_approved: Boolean;&lt;/p&gt;

&lt;p&gt;text:String;&lt;/p&gt;

&lt;p&gt;The code of my entity is following:&lt;br/&gt;
&lt;font color=&quot;#569cd6&quot;&gt;public&lt;/font&gt; &lt;font color=&quot;#569cd6&quot;&gt;class&lt;/font&gt; &lt;font color=&quot;#4ec9b0&quot;&gt;Joke&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#d4d4d4&quot;&gt;{&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#569cd6&quot;&gt;public&lt;/font&gt; &lt;font color=&quot;#4ec9b0&quot;&gt;ObjectId&lt;/font&gt; &lt;font color=&quot;#9cdcfe&quot;&gt;Id&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; { &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;; &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;set&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;; }&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#569cd6&quot;&gt;public&lt;/font&gt; &lt;font color=&quot;#569cd6&quot;&gt;string&lt;/font&gt; &lt;font color=&quot;#9cdcfe&quot;&gt;text&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; { &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;; &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;set&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;; }&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#569cd6&quot;&gt;public&lt;/font&gt; &lt;font color=&quot;#569cd6&quot;&gt;bool&lt;/font&gt; &lt;font color=&quot;#9cdcfe&quot;&gt;is_approved&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; { &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;get&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;; &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;set&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;; }&lt;/font&gt;&lt;br/&gt;
{color:#d4d4d4}}&lt;font color=&quot;&quot;&gt;&lt;br/&gt;
I&apos;m trying the following code:&lt;br/&gt;
&lt;font color=&quot;#4ec9b0&quot;&gt;&lt;/font&gt;IMongoClient&lt;/font&gt; &lt;font color=&quot;#9cdcfe&quot;&gt;client&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; = &lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;new&lt;/font&gt; &lt;font color=&quot;#4ec9b0&quot;&gt;MongoClient&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#9cdcfe&quot;&gt;AppSettings&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;.&lt;/font&gt;&lt;font color=&quot;#9cdcfe&quot;&gt;MongoCredentials&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;);&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#4ec9b0&quot;&gt;IMongoDatabase&lt;/font&gt; &lt;font color=&quot;#9cdcfe&quot;&gt;database&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; = &lt;/font&gt;&lt;font color=&quot;#9cdcfe&quot;&gt;client&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;.&lt;/font&gt;&lt;font color=&quot;#dcdcaa&quot;&gt;GetDatabase&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#ce9178&quot;&gt;&quot;joker&quot;&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;);&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#4ec9b0&quot;&gt;IMongoCollection&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#4ec9b0&quot;&gt;Joke&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;&amp;gt; &lt;/font&gt;&lt;font color=&quot;#9cdcfe&quot;&gt;collection&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; = &lt;/font&gt;&lt;font color=&quot;#9cdcfe&quot;&gt;database&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;.&lt;/font&gt;&lt;font color=&quot;#dcdcaa&quot;&gt;GetCollection&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#4ec9b0&quot;&gt;Joke&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;&amp;gt;(&lt;/font&gt;&lt;font color=&quot;#ce9178&quot;&gt;&quot;jokes&quot;&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;);&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#4ec9b0&quot;&gt;Joke&lt;/font&gt; &lt;font color=&quot;#9cdcfe&quot;&gt;joke&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt; = &lt;/font&gt;&lt;font color=&quot;#9cdcfe&quot;&gt;collection&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;.&lt;/font&gt;&lt;font color=&quot;#dcdcaa&quot;&gt;Find&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#569cd6&quot;&gt;new&lt;/font&gt; &lt;font color=&quot;#4ec9b0&quot;&gt;BsonDocument&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;()).&lt;/font&gt;&lt;font color=&quot;#dcdcaa&quot;&gt;First&lt;/font&gt;&lt;font color=&quot;#d4d4d4&quot;&gt;();&lt;/font&gt;&lt;br/&gt;
&#160;&lt;/p&gt;

&lt;p&gt;The last line gives an exception:&lt;/p&gt;

&lt;p&gt;---&amp;gt; System.FormatException: Cannot deserialize a &apos;String&apos; from BsonType &apos;ObjectId&apos;.&lt;/p&gt;

&lt;p&gt;at MongoDB.Bson.Serialization.Serializers.StringSerializer.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;/p&gt;

&lt;p&gt;at MongoDB.Bson.Serialization.Serializers.SealedClassSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;/p&gt;

&lt;p&gt;at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;/p&gt;

&lt;p&gt;at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)&lt;/p&gt;

&lt;p&gt;at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)&lt;/p&gt;

&lt;p&gt;It is worth to mention that the bug can be reproduced in web application. In console app it works fine.&lt;/p&gt;</description>
                <environment>Linux, .NET Core 3.1, .NET 5.0.5 in ASP.NET Web application</environment>
        <key id="1705588">CSHARP-3653</key>
            <summary>Cannot deserialize a &apos;String&apos; from BsonType &apos;ObjectId&apos;</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="13202">Works as Designed</resolution>
                                        <assignee username="dmitry.lukyanov@mongodb.com">Dmitry Lukyanov</assignee>
                                    <reporter username="robert.lebovich@gmail.com">&#1056;&#1086;&#1073;&#1077;&#1088;&#1090; &#1051;&#1077;&#1081;&#1073;&#1086;&#1074;&#1080;&#1095;</reporter>
                        <labels>
                    </labels>
                <created>Thu, 6 May 2021 22:18:07 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:45 +0000</updated>
                            <resolved>Fri, 21 May 2021 18:01:27 +0000</resolved>
                                    <version>2.12.1</version>
                    <version>2.12.2</version>
                    <version>2.12.3</version>
                                                    <component>Serialization</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3813190" author="JIRAUSER1259599" created="Sat, 22 May 2021 21:12:01 +0000"  >&lt;p&gt;Hi Dmitry,&lt;/p&gt;

&lt;p&gt;Thank you very much for pointing me the error.&#160;&lt;/p&gt;</comment>
                            <comment id="3806092" author="dmitry.lukyanov" created="Fri, 21 May 2021 17:56:00 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=robert.lebovich%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;robert.lebovich@gmail.com&quot;&gt;robert.lebovich@gmail.com&lt;/a&gt;,&lt;br/&gt;
your code contains two definitions of Joke class and this is one which used by the driver:&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;    &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;public&lt;/span&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;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;class&lt;/span&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; Joke {&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;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;public&lt;/span&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; string _id { get; set; }&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;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;public&lt;/span&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; string Text { get; set; }&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;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;public&lt;/span&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; bool IsApproved { get; set; }    &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;

&lt;p&gt;pay attention that this class contains &quot;_id&quot; field as string, so this is exactly what the error &quot;Cannot deserialize a &apos;String&apos; from BsonType &apos;ObjectId&apos;&quot; says for you, you should clean up your code in particular you should use the Joke version where &quot;Id&quot; is defined as ObjectId.&lt;/p&gt;

</comment>
                            <comment id="3798217" author="JIRAUSER1259599" created="Thu, 20 May 2021 22:17:02 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I created a repo that is exact copy of my code but without keys.&lt;/p&gt;

&lt;p&gt;Here is the url: &lt;a href=&quot;http://example.com/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/telebovich/weird-mongodb-behavior&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please tell my if you need the keys for the bot and the database. How can I pass them in a secure way?&lt;/p&gt;

&lt;p&gt;Thank you,&lt;/p&gt;

&lt;p&gt;Tzvi (Robert) Leybovych.&lt;/p&gt;</comment>
                            <comment id="3773474" author="dmitry.lukyanov" created="Fri, 14 May 2021 11:47:30 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=robert.lebovich%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;robert.lebovich@gmail.com&quot;&gt;robert.lebovich@gmail.com&lt;/a&gt;, can you please provide a repro with a particular document that triggers this error? As it was mentioned before, it looks like the error is related to documents structure that you use in the your db, for example it can be done with one more step in your reproduction:&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;IMongoClient client = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; MongoClient(AppSettings.MongoCredentials);&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;IMongoDatabase database = client.GetDatabase(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;joker&quot;&lt;/span&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;IMongoCollection&amp;lt;Joke&amp;gt; collection = database.GetCollection&amp;lt;Joke&amp;gt;(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;jokes_test&quot;&lt;/span&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;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// changed name to ensure that there is only one document in collection&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;collection.InsertOne(BsonDocument.Parse(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;{ add a particular document here }&quot;&lt;/span&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;Joke joke = collection.Find(&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&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; BsonDocument()).First();&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="3773244" author="JIRAUSER1259599" created="Fri, 14 May 2021 08:05:18 +0000"  >&lt;p&gt;Hi James,&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I was pretty sure that the error is in web app. Now I see that it is not.&lt;/p&gt;

&lt;p&gt;My problem is that I created an empty application and added the code for telegram bot.&lt;/p&gt;

&lt;p&gt;It was working without serialization. But then I tried to serialize Bson to my own POCO object it stopped working.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Thank you,&lt;/p&gt;

&lt;p&gt;Tzvi (Robert) Leybovych.&lt;/p&gt;</comment>
                            <comment id="3761463" author="james.kovacs" created="Fri, 7 May 2021 17:29:04 +0000"  >&lt;p&gt;Hi, &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=robert.lebovich%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;robert.lebovich@gmail.com&quot;&gt;robert.lebovich@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for reporting this issue to us. We have attempted to reproduce this issue with the MongoDB .NET/C# driver v2.12.3 and an ASP.NET Core Web App (&lt;tt&gt;dotnet new webapp&lt;/tt&gt;) running on .NET 5.0. We were not able to reproduce the issue.&lt;/p&gt;

&lt;p&gt;Examining the error message:&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;   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;System.FormatException: Cannot deserialize a &apos;String&apos; from BsonType &apos;ObjectId&apos;.&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;This indicates that the driver is attempting to deserialize a string, but found an ObjectId in the database. Given that the only string in your model is the &lt;tt&gt;text&lt;/tt&gt; field of the &lt;tt&gt;Joke&lt;/tt&gt; class, it would suggest that there is a mismatch between your database schema and your C# class definition.&lt;/p&gt;

&lt;p&gt;Please review the documents in your database to see if one contains an &lt;tt&gt;ObjectId&lt;/tt&gt; for the &lt;tt&gt;text&lt;/tt&gt; field in your &lt;tt&gt;joker.jokes&lt;/tt&gt; namespace. If not, please provide a complete self-contained repro of the issue including a &lt;tt&gt;mongodump&lt;/tt&gt; of your &lt;tt&gt;joker.jokes&lt;/tt&gt; namespace as a zip file attached to this case so that we can attempt to reproduce the issue.&lt;/p&gt;

&lt;p&gt;Sincerely,&lt;br/&gt;
James&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|hytu8n:</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>