javascript - 类型错误 : mongodb property insertmany is not a function

标签 javascript mongodb

db.col.insertMany(
    [
        {
        "_id" : "tt0084726",
        "title" : "Star Trek II: The Wrath of Khan",
        "year" : 1982,
        "type" : "movie"
        },
        {
        "_id" : "tt0796366",
        "title" : "Star Trek",
        "year" : 2009,
        "type" : "movie"
        },
        {
        "_id" : "tt0084726",
        "title" : "Star Trek II: The Wrath of Khan",
        "year" : 1982,
        "type" : "movie"
        }
    ]
);

OS: LinuxMint 17.3 Rosa MongoDB: db version v2.6.12

我正在参加 University of MongoDB 的类(class).当我将上述命令输入 mongo shell 时,出现错误:TypeError: Property 'insertMany' of object test.col is not a function 如何解决?我已阅读文档,但仍然失败。

最佳答案

我遇到了类似的问题。你需要有 3.2 版本

> New in version 3.2.

您需要更新您的 mongodb 版本才能使用 insertMany

没那么难。几周前,我使用了 insertMany

关于javascript - 类型错误 : mongodb property insertmany is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37585521/

相关文章:

javascript - 如何在 Three.js 中从 3D 点创建 3D 表面?

javascript - 我正在尝试使用 jquery 启用下拉菜单

c# - 选项卡更改时重定向 url

node.js - mongodb 修改字段名不能以$开头

php - 使用 Mongodb ObjectID 作为文档 ID?

node.js - 使用 Express 不响应进行 Passport 验证

javascript - 如何使用 Redux 获取另一个组件的本地状态

javascript - 如何在点击时获取传单 ImageOverlay 的像素坐标

node.js - 从 Promise 而不是控制台返回值

c# - 为什么我的记录在 mongodb upsert 场景中得到零 objectid?