2016-08-04 60 views
12

當我嘗試調用集合的方法時,爲什麼會出現SyntaxError: missing ; before statement @(shell)的錯誤?謝謝。MongoDB SyntaxError:missing; before statement @(shell)

$ 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 

回答

7

根據documentation

Collection names should begin with an underscore or a letter character

檢查herehere如何刪除或訪問您錯誤地命名集合。

4

您必須打開新的cmd並以管理員身份運行,然後寫入mongoexport。 它在我的mongoDB工作

+0

這爲我工作。 thanx – yadavr

+0

這就是爲我工作 – wintersolider

相關問題