mongodb 使用 group 查询出错

作者: 大白杏仁 | 来源:发表于2018-04-29 21:34 被阅读14次

    # Issue

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

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

    # Solution

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

    相关文章

      网友评论

        本文标题:mongodb 使用 group 查询出错

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