MongoDB SyntaxError:丢失;声明之前@(shell) [英] MongoDB SyntaxError: missing ; before statement @(shell)

查看:259
本文介绍了MongoDB SyntaxError:丢失;声明之前@(shell)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试调用集合的方法时,为什么会出现错误SyntaxError: missing ; before statement @(shell)?谢谢.

When I try to invoke methods of a collection, why is there an error of 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

推荐答案

根据文档

集合名称应以下划线或字母字符开头

Collection names should begin with an underscore or a letter character

此处

Check here or here how to remove or access your wrongly named collection.

这篇关于MongoDB SyntaxError:丢失;声明之前@(shell)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆