您的位置:首页 > 数据库 > Mongodb

mongodb查询数字开头的集合报错

2015-08-19 16:06 465 查看
mongodb查询数字开头的集合报错

mongo库中有数字开头的集合

进行查询

> db.2015BthSpecialAction.find()db.2015BthSpecialAction.find()

Wed Aug 19 16:03:30 SyntaxError: missing ; before statement (shell):1

试了“”还是报错

> db."2015BthSpecialAction".find({ }).limit(50) db."2015BthSpecialAction".find({ }).limit(50)

Wed Aug 19 16:04:19 SyntaxError: missing name after . operator (shell):1

查询资料使用["collection name"] 就可以

> db["2015BthSpecialAction"].findOne()db["2015BthSpecialAction"].findOne()

{

"_id" : ObjectId("5563de68da0a123513c743a2"),

"userId" : "4931368",

"time" : "2015-05-26 10:46:00"

}

用mongoexport 导出 -c 指定不会报错

./mongoexport -d actionsCache -c 2015BthSpecialAction --csv -f userId,time -o user_csv.csv
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: