Ticket migration - Completely stuck

Hello,

I am really stuck, I have read the documentation and other posts to try to figure out the problem, but nothing I try is actually working.

When I try to test my code with "npm test -t migration
", I just get :
“Setup Mongo Connection…” and no answer even after waiting a long time, no error.

To connect, I used :
const host = “myConnexionStringFromFile.Env”
…I also tried with process.env.MFLIX_DB_URI

const client = await MongoClient.connect(
“myConnexionStringFromFile.Env”, // or simply host
{ useNewUrlParser: true },
)

const mflix = client.db(“sample_mflix”) // or process.env.MFLIX_NS

…then for the predicate and the projection :
const predicate = { $and: [{lastupdated: { $exists: true }}, {lastupdated: { $type: “string” }}] }
const projection = {lastupdated: 1}
-> It seems to work on Compass, I get 23539 documents with the _id and lastupdated fields.

…and finally the bulk write :
const { modifiedCount } = await mflix.collection(“movies”).bulkWrite(moviesToMigrate);

I left the rest of the code unchanged.

I can’t see what I missed. Any help would be much appreciated. Thank you !

1 Like

Hi @Abdelkader_69182 edit your post and link it to the course and you’ll get more responses.

Hi @Abdelkader_69182,

If this is the case, try pasting the url here directly. Also, I cannot see the date parsing code here. I have sent you a message where you can share the code. :slight_smile:

Kanika

Hi,

I had the same problem, so I had to replace this line
const mflix = client.db(process.env.MFLIX_NS)
by this
const mflix = client.db(‘sample_mflix’)
works find for me, but I’m too late so I failed this ticket, that’s a pitty :frowning:

Adam

2 Likes

Hi @Adam_57473,

We are in process of updating the handouts for the same. :slight_smile: Thanks for reporting this.

Kanika

FYI I just ran into this issue so it looks like the handouts and class hasn’t be fixed yet.