无法从 shell 访问集合 - SyntaxError: missing ;before 语句(外壳):1 [英] Can't access collection from the shell - SyntaxError: missing ; before statement (shell):1

查看:55
本文介绍了无法从 shell 访问集合 - SyntaxError: missing ;before 语句(外壳):1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个脚本,使用 mongoimport 将 csv 文件加载到 mongodb.当我为两个类似的 csv 文件(相同类型)运行此文件时,它们都可以正常上传,但是我只能从 mongodb shell 访问其中一个.以下是 mongodb shell 会话的记录:

I wrote a script that uses mongoimport to load csv files into mongodb. When I run this for two similar csv files (of the same type) both upload fine, however I can only access one of them from the mongodb shell. Here is a transcript of a mongodb shell session:

> show collections
3mLgQAYJCq6_20110802
eTByWMY7zO6_20110802NonUniCode
system.indexes
> db.3mLgQAYJCq6_20110802
Thu Aug 18 18:44:49 SyntaxError: missing ; before statement (shell):1
> db.eTByWMY7zO6_20110802NonUniCode
vh.eTByWMY7zO6_20110802NonUniCode

但是,我可以从 python 脚本和使用 mongoexport 访问这两个集合.我怀疑 3mLgQAYJCq6_20110802 文件有问题,但我不知道从哪里开始寻找.有什么想法吗?

However, I can access both collections from a python script and using mongoexport. I suspect there is a problem with the 3mLgQAYJCq6_20110802 file but I don't know where to start looking. Any ideas?

推荐答案

当我的集合名称包含特殊字符时,这对我有用:

This works for me when my collection names include special characters:

db["3mLgQAYJCq6_20110802"].findOne();

这篇关于无法从 shell 访问集合 - SyntaxError: missing ;before 语句(外壳):1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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