美文网首页
Mongo Collection的名字当中存在特殊字符时

Mongo Collection的名字当中存在特殊字符时

作者: 大地缸 | 来源:发表于2021-02-24 06:52 被阅读0次

title: "Mongo Collection的名字当中存在特殊字符时"
date: 2021-02-12T22:40:25+08:00
draft: true
tags: ['mongodb']
author: "dadigang"
author_cn: "大地缸"
personal: "http://www.real007.cn"


关于作者

http://www.real007.cn/about

mongo collection name—SyntaxError: identifier starts immediately after numeric literal

当mongo collection的名字当中存在特殊字符时,在shell中对改集合进行操作会报SyntaxError: identifier starts immediately after numeric literal的错误。

解决办法:getCollection函数将collection name转换一下即可

例:

order_cluster:PRIMARY> db.getCollection("order_2017-08").find().count()

12991689

有些工具已经对此做出相应处理,如:MongoChef

image

注意选择value的数据类型

image

相关文章

网友评论

      本文标题:Mongo Collection的名字当中存在特殊字符时

      本文链接:https://www.haomeiwen.com/subject/alypxltx.html