首页 > IT职业 > IT职场 > mongodb 使用 group 查询出错
最近使用 Mongodb 创建 collection 时,创建名为 project.share.group 的集合时会创建成功,并且代码显示数据已保存到集合,在 shell 中也能够通过 show collections 能够查看到对应集合

但是通过 db.project.share.group.find() 命令显示数据时报错,显示TypeError: db.project.share.group.find is not a function

通过 db.getCollection("project.share.group").find() 可成功获取
因为 group 在 mongodb 属于保留字段,当出现时 mongodb 会有另外的意义(具体待 Google~)

作者:大白杏仁
链接:https://www.jianshu.com/p/3dbb7ad98e47
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4418/viewspace-2805021/ ,如需转载,请注明出处,否则将追究法律责任。