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