Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: db.runCommand is not a function #429

Closed
vytautas-pranskunas- opened this issue Mar 21, 2023 · 5 comments
Closed

TypeError: db.runCommand is not a function #429

vytautas-pranskunas- opened this issue Mar 21, 2023 · 5 comments

Comments

@vytautas-pranskunas-
Copy link

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',
                                        },
                                    },
                                },
                            },
                        },
                    },
                });
@vytautas-pranskunas-
Copy link
Author

is this project still supporte? because no response for 3 weeks...

@seppevs
Copy link
Owner

seppevs commented Sep 27, 2023

Try to install the latest mongodb version in your project. The issue is not caused by migrate-mongo, so I'm closing this.

@seppevs seppevs closed this as completed Sep 27, 2023
@vytautas-pranskunas-
Copy link
Author

If i am running this command via mongodb shell all works good. It is failing only once run via migrate mongo.

@seppevs
Copy link
Owner

seppevs commented Sep 27, 2023

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.

@marxxxx
Copy link

marxxxx commented Apr 26, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants