<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:20 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-1345] can&apos;t seem to get a polygon query to work...tried every example ...looks like a driver bug</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1345</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Error condition is:&lt;br/&gt;
The driver tries to (de)serialize a mutlipolygon when it should be a polygon... &lt;/p&gt;

&lt;p&gt;(note: point code works fine)&lt;/p&gt;

&lt;p&gt;class in question has a property that is a polygon. &lt;/p&gt;

&lt;p&gt;The data in the db has the loc field ... as a polygon ...the exception is listed below...&lt;/p&gt;

&lt;p&gt;Offending class (identical to class using point)&lt;/p&gt;

&lt;p&gt;using System;&lt;br/&gt;
using System.Collections.Generic;&lt;br/&gt;
using System.Linq;&lt;br/&gt;
using System.Web;&lt;br/&gt;
using MongoDB.Bson;&lt;br/&gt;
using MongoDB.Bson.Serialization.Attributes;&lt;br/&gt;
using MongoDB.Bson.Serialization.IdGenerators;&lt;br/&gt;
using MongoDB.Driver.GeoJsonObjectModel;&lt;/p&gt;

&lt;p&gt;namespace WebApplicationFacebook.Helpers.Models&lt;br/&gt;
{&lt;br/&gt;
    public class State&lt;br/&gt;
    {&lt;br/&gt;
        &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonId(IdGenerator = typeof(ObjectIdGenerator))&amp;#93;&lt;/span&gt;&lt;br/&gt;
        public ObjectId Id &lt;/p&gt;
{ get; set; }&lt;br/&gt;
&lt;br/&gt;
        &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonElement(&amp;quot;name&amp;quot;)&amp;#93;&lt;/span&gt;&lt;br/&gt;
        public string Name { get; set; }

&lt;p&gt;        &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonElement(&amp;quot;code&amp;quot;)&amp;#93;&lt;/span&gt;&lt;br/&gt;
        public string Code &lt;/p&gt;
{ get; set; }&lt;br/&gt;
&lt;br/&gt;
        &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonElement(&amp;quot;loc&amp;quot;)&amp;#93;&lt;/span&gt;&lt;br/&gt;
        public GeoJsonPolygon&amp;lt;GeoJson2DGeographicCoordinates&amp;gt; Loc { get; set; }

&lt;p&gt;    }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;offending data .....&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
    &quot;_id&quot; : ObjectId(&quot;536b0a143004b15885c91a20&quot;),&lt;br/&gt;
    &quot;name&quot; : &quot;Wyoming&quot;,&lt;br/&gt;
    &quot;code&quot; : &quot;WY&quot;,&lt;br/&gt;
    &quot;loc&quot; : &lt;/p&gt;
{
        &quot;type&quot; : &quot;Polygon&quot;,
        &quot;coordinates&quot; : [ 
            [ 
                [ 
                    -108.6213129999998700, 
                    45.0002769999999830
                ], 
                [ 
                    -104.0576969999999500, 
                    44.9973800000001350
                ], 
                [ 
                    -104.0532489999999900, 
                    41.0014060000000880
                ], 
                [ 
                    -111.0467229999999900, 
                    40.9979589999999800
                ], 
                [ 
                    -111.0551989999998900, 
                    45.0013210000000750
                ], 
                [ 
                    -108.6213129999998700, 
                    45.0002769999999830
                ]
            ]
        ]
    }
&lt;p&gt;}&lt;/p&gt;

{&quot;An error occurred while deserializing the Loc property of class WebApplicationFacebook.Helpers.Models.State: Invalid GeoJson type: &apos;MultiPolygon&apos;. Expected: &apos;Polygon&apos;.&quot;}

&lt;p&gt;System.AggregateException was unhandled by user code&lt;br/&gt;
  HResult=-2146233088&lt;br/&gt;
  Message=One or more errors occurred.&lt;br/&gt;
  Source=mscorlib&lt;br/&gt;
  StackTrace:&lt;br/&gt;
       at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)&lt;br/&gt;
       at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)&lt;br/&gt;
       at System.Threading.Tasks.Task`1.get_Result()&lt;br/&gt;
       at WebApplicationFacebook.Services.MongoGeoJsonRepository.GetStates() in c:\Git\WebApplicationFacebook\WebApplicationFacebook\Services\MongoGeoJsonRepository.cs:line 747&lt;br/&gt;
       at ServiceTest.MongoRepositoryTests.TestMethodStates() in c:\Git\WebApplicationFacebook\ServiceTest\MongoRepositoryTests.cs:line 147&lt;br/&gt;
  InnerException: System.FormatException&lt;br/&gt;
       HResult=-2146233033&lt;br/&gt;
       Message=An error occurred while deserializing the Loc property of class WebApplicationFacebook.Helpers.Models.State: Invalid GeoJson type: &apos;MultiPolygon&apos;. Expected: &apos;Polygon&apos;.&lt;br/&gt;
       Source=MongoDB.Bson&lt;br/&gt;
       StackTrace:&lt;br/&gt;
            at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)&lt;br/&gt;
            at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)&lt;br/&gt;
            at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
            at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize&lt;span class=&quot;error&quot;&gt;&amp;#91;TValue&amp;#93;&lt;/span&gt;(IBsonSerializer`1 serializer, BsonDeserializationContext context)&lt;br/&gt;
            at MongoDB.Driver.Core.WireProtocol.Messages.Encoders.BinaryEncoders.ReplyMessageBinaryEncoder`1.ReadMessage()&lt;br/&gt;
            at MongoDB.Driver.Core.WireProtocol.Messages.Encoders.BinaryEncoders.ReplyMessageBinaryEncoder`1.MongoDB.Driver.Core.WireProtocol.Messages.Encoders.IMessageEncoder.ReadMessage()&lt;br/&gt;
            at MongoDB.Driver.Core.Connections.BinaryConnection.&amp;lt;ReceiveMessageAsync&amp;gt;d__15.MoveNext()&lt;br/&gt;
         &amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
            at MongoDB.Driver.Core.WireProtocol.QueryWireProtocol`1.&amp;lt;ExecuteAsync&amp;gt;d__0.MoveNext()&lt;br/&gt;
         &amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
            at MongoDB.Driver.Core.Servers.ClusterableServer.ServerChannel.&amp;lt;ExecuteProtocolAsync&amp;gt;d__24`1.MoveNext()&lt;br/&gt;
         &amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
            at MongoDB.Driver.Core.Operations.FindOperation`1.&amp;lt;ExecuteAsync&amp;gt;d__2.MoveNext()&lt;br/&gt;
         &amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
            at MongoDB.Driver.OperationExecutor.&amp;lt;ExecuteReadOperationAsync&amp;gt;d__0`1.MoveNext()&lt;br/&gt;
         &amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()&lt;br/&gt;
            at MongoDB.Driver.MongoCollectionImpl`1.&amp;lt;ExecuteReadOperation&amp;gt;d__35`1.MoveNext()&lt;br/&gt;
         &amp;#8212; End of stack trace from previous location where exception was thrown &amp;#8212;&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;br/&gt;
            at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()&lt;br/&gt;
            at WebApplicationFacebook.Services.MongoGeoJsonRepository.&amp;lt;GetAllStates&amp;gt;d__75.MoveNext() in c:\Git\WebApplicationFacebook\WebApplicationFacebook\Services\MongoGeoJsonRepository.cs:line 755&lt;br/&gt;
       InnerException: System.FormatException&lt;br/&gt;
            HResult=-2146233033&lt;br/&gt;
            Message=Invalid GeoJson type: &apos;MultiPolygon&apos;. Expected: &apos;Polygon&apos;.&lt;br/&gt;
            Source=MongoDB.Driver&lt;br/&gt;
            StackTrace:&lt;br/&gt;
                 at MongoDB.Driver.GeoJsonObjectModel.Serializers.GeoJsonObjectSerializerHelper`1.EnsureTypeIsValid(BsonDeserializationContext context)&lt;br/&gt;
                 at MongoDB.Driver.GeoJsonObjectModel.Serializers.GeoJsonObjectSerializerHelper`1.DeserializeBaseMember(BsonDeserializationContext context, String elementName, Int64 flag, GeoJsonObjectArgs`1 args)&lt;br/&gt;
                 at MongoDB.Driver.GeoJsonObjectModel.Serializers.GeoJsonPolygonSerializer`1.&amp;lt;&amp;gt;c_&lt;em&gt;DisplayClass1.&amp;lt;DeserializeValue&amp;gt;b&lt;/em&gt;_0(String elementName, Int64 flag)&lt;br/&gt;
                 at MongoDB.Bson.Serialization.Serializers.SerializerHelper.DeserializeMembers(BsonDeserializationContext context, Action`2 memberHandler)&lt;br/&gt;
                 at MongoDB.Driver.GeoJsonObjectModel.Serializers.GeoJsonPolygonSerializer`1.DeserializeValue(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
                 at MongoDB.Bson.Serialization.Serializers.ClassSerializerBase`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
                 at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)&lt;br/&gt;
                 at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)&lt;br/&gt;
                 at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)&lt;br/&gt;
            InnerException: &lt;/p&gt;

&lt;p&gt;.... test code is as follows:&lt;/p&gt;


&lt;p&gt;        public IMongoDatabase GetDataBase()&lt;br/&gt;
        {&lt;br/&gt;
            if (!localMongo.IsNullOrWhiteSpace())&lt;br/&gt;
            {&lt;br/&gt;
                if (!geoTest.IsNullOrWhiteSpace())&lt;br/&gt;
                {&lt;br/&gt;
                    try&lt;br/&gt;
                    {&lt;br/&gt;
                        if (mongoClient == null)&lt;/p&gt;
                        {
                            mongoClient = new MongoClient(localMongo);
                        }
&lt;p&gt;                        return mongoClient.GetDatabase(geoTest);&lt;/p&gt;

&lt;p&gt;                    }&lt;br/&gt;
                    catch (Exception exp)&lt;/p&gt;
                    {
                        log.Error(&quot;getDataBase failed&quot;, exp);
                    }
&lt;p&gt;                }&lt;br/&gt;
            }&lt;br/&gt;
            throw new ApplicationException(&quot;Unable to create Mongo Client database is null&quot;);&lt;br/&gt;
        }&lt;/p&gt;

&lt;p&gt;        public IMongoCollection&amp;lt;State&amp;gt; GetStatesCollection()&lt;/p&gt;
        {
            var db = GetDataBase();
            var collection = db.GetCollection&amp;lt;State&amp;gt;(&quot;states&quot;);
            return collection;
        }

&lt;p&gt;        public async Task&amp;lt;List&amp;lt;State&amp;gt;&amp;gt; GetAllStates()&lt;br/&gt;
        {&lt;br/&gt;
            var stateCollection = GetStatesCollection();&lt;br/&gt;
            List&amp;lt;State&amp;gt; states = new List&amp;lt;State&amp;gt;();&lt;br/&gt;
            using (var cursor = await stateCollection.FindAsync(p =&amp;gt; p.Name != &quot;&quot;))&lt;br/&gt;
            {&lt;br/&gt;
                while (await cursor.MoveNextAsync())&lt;br/&gt;
                {&lt;br/&gt;
                    var batch = cursor.Current;&lt;br/&gt;
                    foreach (var state in batch)&lt;/p&gt;
                    {
                        states.Add(state);
                    }
&lt;p&gt;                }&lt;br/&gt;
            }&lt;br/&gt;
            return states;&lt;br/&gt;
        }&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Reporter&lt;/b&gt;: George Celvi&lt;br/&gt;
&lt;b&gt;E-mail&lt;/b&gt;: &lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;mailto:georgepcelvi@aol.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;georgepcelvi@aol.com&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/mail_small.gif&quot; height=&quot;12&quot; width=&quot;13&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;</description>
                <environment>Windows, Driver is version 2.1&lt;br/&gt;
Mongo DB Version is 3.0.1&lt;br/&gt;
&lt;br/&gt;
*Location*: &lt;a href=&quot;http://docs.mongodb.org/ecosystem/drivers/csharp/&quot;&gt;http://docs.mongodb.org/ecosystem/drivers/csharp/&lt;/a&gt;&lt;br/&gt;
*User-Agent*: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36&lt;br/&gt;
*Referrer*: &lt;a href=&quot;https://www.google.com/&quot;&gt;https://www.google.com/&lt;/a&gt;&lt;br/&gt;
*Screen Resolution*: 1920 x 1080&lt;br/&gt;
*repo*: docs-ecosystem&lt;br/&gt;
*source*: drivers/csharp&lt;br/&gt;
</environment>
        <key id="216293">CSHARP-1345</key>
            <summary>can&apos;t seem to get a polygon query to work...tried every example ...looks like a driver bug</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                                <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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="xgen-internal-docs">Docs Collector User</reporter>
                        <labels>
                            <label>collector-298ba4e7</label>
                            <label>question</label>
                    </labels>
                <created>Sun, 12 Jul 2015 05:59:14 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:57 +0000</updated>
                            <resolved>Wed, 26 Oct 2016 21:50:22 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1418922" author="jeff.yemin" created="Wed, 26 Oct 2016 21:50:22 +0000"  >&lt;p&gt;Someone asked a question using the Docs Collector.  We can&apos;t really answer it here, as the original asker is not the reporter.&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|hsb4fz:</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>