M220J: Ticket Migration

I migrated movies.lastupdated and movies.imdb.rating. I checked the Compass that those 2 types are changed and unit test passed. But still get error from status page: “Migration: It does not appear that you correctly converted the type”.
I searched this ticket for other classes, it may due to the documents count… Currently i have 45,993 documents in movie collection…

I have the same problem. Changed types and unit tests passed but Status page keeps saying “Migration: It does not appear that you correctly converted the type”

I am also having same issue, did you have any luck finding out the issue?

Please just follow the thread if you don’t bring anything to the solution. When a solution is found you will see it if you follow the thread. This will help us by reducing the amount of posting we have to read.

Thank you

I had issues with the SimpleDateFormat. I had to launch the script two times with different patterns because I couldn’t find one for matching every String Date, it throws “Unparseable date” depending on the format with/without MS. I don’t know the tests is passing website, but could be the reason if we don’t save exactly the same Date in DB?

Hi @CHAO_49004,

This is the expected.

Make sure that the getMovie method, in your MovieDao.java is return the fields that we are migrating!


1 Like

Which thread do you mean? I searched on Saturday and there is no Topic for Migration, so I opened a new one. Did I miss something?

Sorry it was not clear. My response was not for you but for @mariodt and @ashukhard. Having to read posts that just say ‘I have the same problem’ slows the process since we have to read posts that do not help.

Hi mariodt,
I had to do the same as you. However, after having applied both patterns, all the ‘lastupdated’ fields of the ‘movies’ collection were correctly updated. As a result, the ticket is passing for me.
It may not help you progressing but it eliminates this cause.


I can confirm that the ticket is working, when I’ve converted both types to needed type, test passed and validation code appeared

Finally solved! In getMovie method, in MovieDao.java, didn’t pass Options to $unwind and it didn’t return data for the MovieId because couldn’t find comments for it. It depends on the way you are getting comments for that movie in the method. Make sure your method is returning data

Thank you! Yes the root cause is to sort the comments, i unwind the array and then group them by _id, but all other fields were lost due to group.

Hi @Norberto
“yyyy-MM-dd HH:mm:ss” This is the correct dataformat?
Thank you.

I found that there are two types of format:

  • yyyy-MM-dd HH:mm:ss.SSSSSSSSS
  • yyyy-MM-dd HH:mm:ss

For this it is easier to use: yyyy-MM-dd HH:mm:ss.SSSXXX

I have been through this thread and still not sure why this error occurs. please guide

I could resolve this by using the yyyy-MM-dd HH:mm:ss pattern (notice the space instead of the ‘T’)
and by clipping the field:
String lastUpdated = doc.getString(“lastupdated”).substring(0, 19);
in the transformDates method.

1 Like

I think the main problem is to set datePattern corrently, or the date convert might fail.

@Matyas_Olah’s solution can work, but I think the course need to update.

I’d like to use
String datePattern = "yyyy-MM-dd hh:mm:ss.SSS";
However some record lastupdate time is without milliseconds.