Collection 未定义
Collection is not defined
嗨,我是 MongoDB 的新手,我在使用一些我确信应该可以正常工作的命令时遇到了问题。
现在 collection 很不幸地被命名为 "fea5dc60-b898-11e4-ac68-a5f571ea05d9"。所以我显然想重命名它。但无论我使用什么命令,它一直说 "b898 is not defined"。我有一种感觉,因为名称中的破折号引起了混淆。
我已经尝试了所有这些,但我一直收到该错误。我知道这些命令有效,因为我安装了 MongoVUE,它显示了它正在使用的命令..我直接将该命令复制并粘贴到控制台中:
db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.renameCollection("NAME")
db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.find()
db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.find().limit(100)
有什么帮助吗?我真的很想重命名这个 collection!
编辑(正在发生的事情的示例):
> show dbs
admin (empty)
haymon_boxing 0.078GB
local 0.078GB
> use haymon_boxing
switched to db haymon_boxing
> show collections
fea5dc60-b898-11e4-ac68-a5f571ea05d9
system.indexes
> db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.find().limit(100)
2015-03-02T13:29:31.818-0800 ReferenceError: b898 is not defined
这有效
db["fea5dc60-b898-11e4-ac68-a5f571ea05d9"].find()
在 MongoDB 中,collection 不应包含某些字符,例如连字符“-”或斜杠“/”。手册对此事有这样的说法:
Collection names should begin with letters or an underscore and may
include numbers; $ is reserved. Collections can be organized in
namespaces; these are named groups of collections defined using a dot
notation.
否则将您的 collection 包裹在 []
中,并确保删除 db...
之后的任何 .
嗨,我是 MongoDB 的新手,我在使用一些我确信应该可以正常工作的命令时遇到了问题。
现在 collection 很不幸地被命名为 "fea5dc60-b898-11e4-ac68-a5f571ea05d9"。所以我显然想重命名它。但无论我使用什么命令,它一直说 "b898 is not defined"。我有一种感觉,因为名称中的破折号引起了混淆。
我已经尝试了所有这些,但我一直收到该错误。我知道这些命令有效,因为我安装了 MongoVUE,它显示了它正在使用的命令..我直接将该命令复制并粘贴到控制台中:
db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.renameCollection("NAME")
db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.find()
db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.find().limit(100)
有什么帮助吗?我真的很想重命名这个 collection!
编辑(正在发生的事情的示例):
> show dbs
admin (empty)
haymon_boxing 0.078GB
local 0.078GB
> use haymon_boxing
switched to db haymon_boxing
> show collections
fea5dc60-b898-11e4-ac68-a5f571ea05d9
system.indexes
> db.fea5dc60-b898-11e4-ac68-a5f571ea05d9.find().limit(100)
2015-03-02T13:29:31.818-0800 ReferenceError: b898 is not defined
这有效
db["fea5dc60-b898-11e4-ac68-a5f571ea05d9"].find()
在 MongoDB 中,collection 不应包含某些字符,例如连字符“-”或斜杠“/”。手册对此事有这样的说法:
Collection names should begin with letters or an underscore and may include numbers; $ is reserved. Collections can be organized in namespaces; these are named groups of collections defined using a dot notation.
否则将您的 collection 包裹在 []
中,并确保删除 db...
.