<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39: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-1483] Serialization of DateTimeOffset fields</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1483</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Hi,&lt;br/&gt;
in our object model we have some DateTimeOffset properties that are stored in mongodb like that when using the c# driver.&lt;/p&gt;

&lt;p&gt;&quot;ct&quot; : &lt;span class=&quot;error&quot;&gt;&amp;#91;NumberLong(&amp;quot;635832589587284402&amp;quot;), 0&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Now we wanted to put a compoundindex on our document that included one of those DateTimeOffset fields. We found out that the index would make our query not work anymore when it includes the DateTimeOffset field. So far so good. The DateTimeOffset is stored as array of Ticks in LocalTime and the offset to UTC.&lt;/p&gt;

&lt;p&gt;We could make the index work by using something like ct.0 but with that wewould only query on the ticks in localTime. For us this might lead to inconsistent results so we don&apos;t want to go that way.&lt;/p&gt;

&lt;p&gt;What is the best approach to solve this issue? We are thinking about our own serializer for the DateTimeOffset fields so we can serlialze those fields in UTC.&lt;/p&gt;

&lt;p&gt;Regards&lt;br/&gt;
Hendrik&lt;/p&gt;</description>
                <environment></environment>
        <key id="240417">CSHARP-1483</key>
            <summary>Serialization of DateTimeOffset fields</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="hendrik.ruemmler@soloplan.de">Hendrik R&#252;mmler</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Fri, 20 Nov 2015 11:31:10 +0000</created>
                <updated>Mon, 15 Nov 2021 21:46:43 +0000</updated>
                            <resolved>Fri, 4 Dec 2015 14:55:31 +0000</resolved>
                                    <version>2.0.2</version>
                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1094374" author="craiggwilson" created="Fri, 20 Nov 2015 16:19:12 +0000"  >&lt;p&gt;Nope... If we&apos;ve done LINQ right, it should just work unless you want to search by certain sub properties of the DateTimeOffset. If that is the case, you&apos;ll need to implement IBsonDocumentSerializer or IBsonArraySerializer with respect to your chosen serialiization format.&lt;/p&gt;</comment>
                            <comment id="1094358" author="hendrik.ruemmler@soloplan.de" created="Fri, 20 Nov 2015 16:12:24 +0000"  >&lt;p&gt;Thanks for your response. How would this interact with LINQ? The serializer works for the store and restore of the property but how does a changed serialization work togehter with LINQ to MongoDB query. Is there something else we need to implement?&lt;/p&gt;</comment>
                            <comment id="1094329" author="craiggwilson" created="Fri, 20 Nov 2015 15:46:12 +0000"  >&lt;p&gt;If you need something different than the current serialization format, you&apos;ll need to write your own serializer. The existing serializer is here: &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Bson/Serialization/Serializers/DateTimeOffsetSerializer.cs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Bson/Serialization/Serializers/DateTimeOffsetSerializer.cs&lt;/a&gt;.&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|hsej6n:</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>