TypeError: db.runCommand is not a function
vytautas-pranskunas- opened this issue · 5 comments
I get this error when trying to run this script:
await db.runCommand({
collMod: 'users',
validator: {
$jsonSchema: {
bsonType: 'object',
properties: {
details: {
bsonType: 'object',
properties: {
type: {
enum: ['valueOne', 'valueTwo'],
description: 'Can only be one of the enum values',
},
},
},
},
},
},
});
is this project still supporte? because no response for 3 weeks...
Try to install the latest mongodb version in your project. The issue is not caused by migrate-mongo, so I'm closing this.
If i am running this command via mongodb shell all works good. It is failing only once run via migrate mongo.
migrate-mongo is just a wrapper project around the mongodb node.js dependency. I suggest to see which version of mongodb
is installed in your migration project.
@vytautas-pranskunas- In case this is still relevant. I was receiving the same error but was able to solve it by calling db.command()
instead of db.runCommand()
. The parameters are the same.
This SO-Thread was pointing me in the right direction: https://stackoverflow.com/questions/49765120/node-mongo-db-runcommand-is-not-a-function