[JAVA-3106] org.bson.codecs.configuration.CodecConfigurationException: Unexpected key '_id' found when decoding a GeoJSON Polygon Created: 30/Nov/18  Updated: 27/Oct/23  Resolved: 11/Jan/19

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 3.9.1
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Julien Deruere Assignee: Unassigned
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I'm trying to do something like this:

 

 

    @Override
    public Single<List<Polygon>> fetch(String type) {
        return Flowable.fromPublisher(db.getCollection("Geo").find(Polygon.class)).toList();
    }

 

And my data into Mongo look like this:

 

{
  "_id" : {
    "$oid" : "5c0198b76fa4232797f6dab3"
  },
  "type" : "Polygon",
  "coordinates" : [[[-73.6568398, 45.3489589], [-73.6568142, 45.3489519], [-73.6439382, 45.3459906], [-73.6442889, 45.3459393], [-73.6442635, 45.345544], [-73.6300828, 45.3422097], [-73.6303376, 45.3420899], [-73.6327088, 45.341434], [-73.6328585, 45.3411442], [-73.6352103, 45.3400601], [-73.6368703, 45.3387656], [-73.6391182, 45.3368359], [-73.6391463, 45.3364444], [-73.6393128, 45.3362542], [-73.5499746, 45.3352166], [-73.5503262, 45.3355085], [-73.5505935, 45.3356249], [-73.5507069, 45.3357605], [-73.553482, 45.3812882], [-73.5532513, 45.381684], [-73.5534832, 45.3822501], [-73.5534625, 45.3824753], [-73.5531996, 45.3826634], [-73.5529573, 45.3826032], [-73.5523217, 45.3836163], [-73.5539367, 45.3849366], [-73.5540223, 45.3850901], [-73.5536887, 45.3855998], [-73.5535799, 45.3857217], [-73.5535129, 45.3857042], [-73.5534474, 45.3858705], [-73.5535062, 45.3861518], [-73.5536221, 45.3862777], [-73.5537594, 45.386313], [-73.5544263, 45.3861371], [-73.5555124, 45.3860571], [-73.5580707, 45.3861387], [-73.5597924, 45.3866849], [-73.5603524, 45.3869875], [-73.5621284, 45.3874869], [-73.5690287, 45.3879769], [-73.5709898, 45.3887178], [-73.5714146, 45.3890014], [-73.5727993, 45.3897616], [-73.5746916, 45.3904064], [-73.5747297, 45.3904629], [-73.5754079, 45.3907031], [-73.5761108, 45.3910274], [-73.5761435, 45.3909614], [-73.5767899, 45.3911799], [-73.5767432, 45.3912706], [-73.5780854, 45.3917675], [-73.5787108, 45.3923311], [-73.5816045, 45.393303], [-73.5838936, 45.3940853], [-73.5856611, 45.3946817], [-73.5869435, 45.3950047], [-73.5896876, 45.3952954], [-73.5925802, 45.3953618], [-73.5956126, 45.3953371], [-73.5977227, 45.3909278], [-73.6006804, 45.3852008], [-73.6027178, 45.3848387], [-73.6034262, 45.38501], [-73.6069678, 45.3848462], [-73.6090907, 45.3851391], [-73.6088915, 45.3855984], [-73.6091509, 45.3856998], [-73.6119056, 45.3855586], [-73.6136514, 45.3860946], [-73.6169255, 45.3788201], [-73.6224572, 45.3728175], [-73.6313534, 45.36519], [-73.6410752, 45.3572714], [-73.647577, 45.3529636], [-73.6523657, 45.3504977], [-73.6568398, 45.3489589]]]
}

What am I doing wrong?

 



 Comments   
Comment by Jeffrey Yemin [ 01/Dec/18 ]

Hi jderuere

What do you expect the document to look like? This appears to match the specification for Polygon in the RFC:

o For type "Polygon", the "coordinates" member MUST be an array of
linear ring coordinate arrays.

o For Polygons with more than one of these rings, the first MUST be
the exterior ring, and any others MUST be interior rings. The
exterior ring bounds the surface, and the interior rings (if
present) bound holes within the surface.

Generated at Thu Feb 08 08:58:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.