Hi All,
I am getting below error while running node movie-last-updated-migration.js command.
Error during migration, MongoError: cannot do raw queries on admin in atlas
Hi All,
I am getting below error while running node movie-last-updated-migration.js command.
Error during migration, MongoError: cannot do raw queries on admin in atlas
Me too, have you made any progress with that?
Apparently specifying the database expressly solves the problem, ie use “sample_mflix” instead of “process.env.MFLIX_NS”
Hi @Nnamdi_98218,
I did as per your comment but now when i enter
node movie-last-updated-migration.js
its stuck
my code looks like
const predicate = { 'lastupdated': { $exists: true,$type:'string' } }
const projection = {'lastupdated':1}
const cursor = await mflix
.collection("movies")
.find(predicate, projection)
.toArray()
const moviesToMigrate = cursor.map(({ _id, lastupdated }) => ({
updateOne: {
filter: { _id: ObjectId(_id) },
update: {
$set: { lastupdated: new Date(Date.parse(lastupdated)) },
},
},
}))
Still having this challenge? I understand the particular script can take some time to complete
It helped me to fix the issue with the lastupdated. Many Many thanks