mongoimport is intended to run in command prompt and not in the mongo shell. Open the " Mongo/ Server/ 3. 4/ bin " folder of mongo db in another command window and try again. fluentd+ mongo- plugin+ MongoDBでオシャレにログを貯めこんでみようと思いました。 構築はこちら. find( ) ; Tue Apr 17 20: 27: 06 SyntaxError: missing ; before statement ( shell) : 1. This works for me when my collection names include special characters: db[ " 3mLgQAYJCq6_ 0802" ]. I also encountered a similar problem. insert( ( " username" : " liaojianguo" ) ) ; into db. insert( { " username" : " liaojianguo" } ) ; Then the problem was solved. You can try this method.
c: \ mongodb- win32- x86_ \ bin> mongo. exe MongoDB shell version: 2. 1- pre- connecting to: test > mongorestore - - db test - - drop \ dump\ test Mon Mar 26 11: 29: 13 SyntaxError: missing ; before statement ( shell) : 1 >. You are probably running this command under mongo shell. As you can see in the path program files/ mongodb/ server/ 3. 2/ bin there is no command under mongod as mongoimport. So in order to solve the problem, navigate. When I try to invoke methods of a collection, why is there an error of SyntaxError: missing ; before statement? $ mongo MongoDB shell version: 3. 8 connecting to: test Welcome to the MongoDB shell. For interactive help. mongoexport must be run from your OS command shell, not the mongo shell. According to documentation. Collection names should begin with an underscore or a letter character. Check here or here how to remove or access your wrongly named collection.