@@ -178,6 +178,28 @@ void shouldRetrieveListSubdocumentList() {
178178 assertTrue (contacts .stream ().allMatch (d -> d .size () == 3 ));
179179 }
180180
181+ @ Test
182+ void shouldConvertFromListSubdocumentListNotUsingKey () {
183+ CommunicationEntity entity = createDocumentListNotHavingId ();
184+ entityManager .insert (entity );
185+
186+ }
187+
188+ @ Test
189+ void shouldRetrieveListSubdocumentListNotUsingKey () {
190+ CommunicationEntity entity = entityManager .insert (createDocumentListNotHavingId ());
191+ Element key = entity .find (KEY_NAME ).get ();
192+ SelectQuery query = select ().from ("AppointmentBook" ).where (key .name ()).eq (key .get ()).build ();
193+
194+ CommunicationEntity documentEntity = entityManager .singleResult (query ).get ();
195+ assertNotNull (documentEntity );
196+
197+ List <List <Element >> contacts = (List <List <Element >>) documentEntity .find ("contacts" ).get ().get ();
198+
199+ assertEquals (3 , contacts .size ());
200+ assertTrue (contacts .stream ().allMatch (d -> d .size () == 3 ));
201+ }
202+
181203 @ Test
182204 void shouldRunAQL () {
183205 CommunicationEntity entity = getEntity ();
@@ -412,6 +434,25 @@ private CommunicationEntity createDocumentList() {
412434 return entity ;
413435 }
414436
437+ private CommunicationEntity createDocumentListNotHavingId () {
438+ String id = UUID .randomUUID ().toString ();
439+ CommunicationEntity entity = CommunicationEntity .of ("AppointmentBook" );
440+ entity .add (Element .of ("_id" , "ids" ));
441+ List <List <Element >> documents = new ArrayList <>();
442+
443+ documents .add (asList (Element .of ("name" , "Ada" ), Element .of ("type" , ContactType .EMAIL ),
444+ Element .
of (
"information" ,
"[email protected] " )));
445+
446+ documents .add (asList (Element .of ("name" , "Ada" ), Element .of ("type" , ContactType .MOBILE ),
447+ Element .of ("information" , "11 1231231 123" )));
448+
449+ documents .add (asList (Element .of ("name" , "Ada" ), Element .of ("type" , ContactType .PHONE ),
450+ Element .of ("information" , "phone" )));
451+
452+ entity .add (Element .of ("contacts" , documents ));
453+ return entity ;
454+ }
455+
415456 private List <CommunicationEntity > getEntitiesWithValues () {
416457 var lucas = CommunicationEntity .of (COLLECTION_NAME );
417458 lucas .add (Element .of ("name" , "Lucas" ));
0 commit comments