@Jorge_Nava The error message “MongoServerError: command not found” indicates that the MongoDB server was unable to find the command that was executed. This could be due to a number of reasons, such as incorrect syntax or an invalid command. One possible reason is that the command being executed is not supported by the version of MongoDB that you are using.
To troubleshoot the issue, you can check the version of MongoDB that you are using and compare it to the documentation to ensure that the command is supported. You should also validate the syntax of the command and ensure that it is correct.
Another thing to consider is that the error message suggests that the command is being executed as a top-level command, rather than being executed in the context of a specific database. You may want to try running the command within a specific database by specifying the database name in the command.
Finally, you can try using a different approach to executing the command, such as using the MongoDB shell or a different driver method. For example, instead of using db.command(eval(commandString)), you could try using db.eval(commandString) or a different driver method that is better suited for the type of command that you are executing.
Overall, the key is to validate the syntax of the command, ensure that it is supported by the version of MongoDB that you are using, and consider using a different approach to executing the command if necessary.
1 Like