How to use the bulkWrite function?

Hi all,
sorry for the last minute call, I try to end the migration ticket and I’m stuck with that message :
~/M220/mflix-js/src/migrations$ node movie-last-updated-migration.js
Found 45993 documents to update
0 documents updated

So I guess I misused the bulkWrite function, but I don’t see why (I followed the guide page given in the ticket). Here is how I call the function :
// TODO: Complete the BulkWrite statement below
const col = mflix.collection(‘bulk_write’);
const { modifiedCount } = await col.bulkWrite( moviesToMigrate, {ordered: false} )

What do I do wrong ?


1 Like

Please make sure you are using the right collection name. I believe it is “movies” collection.

Let me know if it works.


Thanks so much Kanika, it’s so simple, I missed it, I don’t know why.
I was focused on the other parts of the ticket, and didn’t pay attention to that line.

You saved my day :wink:

No issues. I am glad it worked out. :slight_smile: