MongoDB SyntaxError: missing; before operation @ (shell)

When I try to call collection methods, why does SyntaxError: missing ; before statement @(shell) SyntaxError: missing ; before statement @(shell) ? Thanks.

 $ mongo MongoDB shell version: 3.2.8 connecting to: test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user Server has startup warnings: 2016-08-04T11:58:21.138-0400 I CONTROL [initandlisten] 2016-08-04T11:58:21.138-0400 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2016-08-04T11:58:21.138-0400 I CONTROL [initandlisten] ** We suggest setting it to 'never' 2016-08-04T11:58:21.138-0400 I CONTROL [initandlisten] 2016-08-04T11:58:21.139-0400 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. 2016-08-04T11:58:21.139-0400 I CONTROL [initandlisten] ** We suggest setting it to 'never' 2016-08-04T11:58:21.139-0400 I CONTROL [initandlisten] > show dbs mydb 0.000GB local 0.000GB > use mydb switched to db mydb > show collections 201607012 > db mydb > mydb.201607012.find() 2016-08-04T12:10:23.826-0400 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:4 > db.201607012.find() 2016-08-04T12:10:29.000-0400 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:2 > db.201607012.find() 2016-08-04T12:11:09.115-0400 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:2 > db.201607012.stats() 2016-08-04T12:13:06.022-0400 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:2 
+16
source share
3 answers

According to the documentation

Collection names must begin with an underscore or letter

Check here or here how to delete or access your erroneously named collection.

+8
source

You need to open a new cmd and run as administrator, then write mongoexport. He worked in my mongoDB

+6
source

I had exactly the same problem. I searched for several hours but did not find a suitable answer in the forum. This is because Mongo Shell is not installed as a service on Windows. See the tutorial below. In this guide, I installed Mongo Shell as a service, and the problem was resolved. https://www.youtube.com/watch?v=ll2tY6KH8Tk

https://discourse-cdn-sjc1.com/business4/uploads/mongodb_university/original/2X/8/8cf565dc93d8154618177fc01a3913017273f802.jpeg

And one more thing that I suggest you install git bash is really better than Windows Command. https://git-scm.com/download/win

0
source

Source: https://habr.com/ru/post/1013633/


All Articles