Migration, Tests Pass but no code

Hi there Ive Created the migration script and both the script and the test ( running the npm - test command ) pass with no errors. for some reason the status page that generates the code however still says “Migration: It does not appear that you correctly converted the type” i have now tried every variation of changing the type to ISODate but to no avail… any ideas ?


1 Like

Hey Thomas,

I just completed that and found that I did not need to change the moviesToMigrate variable. Here it is to make sure yours still matches:

    const moviesToMigrate = cursor.map(({ _id, lastupdated }) => ({
      updateOne: {
        filter: { _id: ObjectId(_id) },
        update: {
          $set: { lastupdated: new Date(Date.parse(lastupdated)) },

You only need to change the items listed in the TODOs .

In another ticket, the page wasn’t updating properly, but functioned correctly when opening my browser in Incognito. If the test is passing, you might give that a try to get the validation code.

Hope that helps!

  • Chris

hmm that didnt seem to work ( tried that but still getting the error.) thanks for the help though

Ive also verified that the migration works as expected and will only add a date to items that have the field and are a string. so this should pass.