[JAVA-2760] Codec conversion for list of list Created: 29/Jan/18  Updated: 28/Oct/23  Resolved: 30/Jan/18

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

Type: Task Priority: Major - P3
Reporter: Rohit Jain Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2756 Fix nested collections handling of nu... Closed

 Description   

I am getting following error "readStartArray can only be called when CurrentBSONType is ARRAY, not when CurrentBSONType is NULL"

It is trying to convert into List<List<T>>
and data in mongo is
[
[

{ "id" : 10927809, }

,

{ "id" : 10927810, }

],
null
]
I am using mongo 3.6 with java async driver 3.6



 Comments   
Comment by Ross Lawley [ 30/Jan/18 ]

Hi rohit.jain,

This is a duplicate of JAVA-2756 and a fix is due in the 3.7.0 release.

Ross

Comment by Githook User [ 30/Jan/18 ]

Author:

{'email': 'ross.lawley@gmail.com', 'name': 'Ross Lawley', 'username': 'rozza'}

Message: Tests: Extra PojoCodec tests for nulls in collections

JAVA-2756 JAVA-2760
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/90627726414d042fd02cbd24239b5cfadd4fcb16

Comment by Rohit Jain [ 30/Jan/18 ]

There is a value which is null in the list, I can see why conversion will fail. Is there a work around for this ?

May be write my own codec which extends current BsonArrayCodec and handle null or implement a custom codec which only handles this particular pojo. If that is the solution, I would appreciate if you could point me to appropriate documentation to do so.

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