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 版本
您需要更新您的 mongodb 版本才能使用 insertMany
。
没那么难。几周前,我使用了 insertMany
关于javascript - 类型错误 : mongodb property insertmany is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37585521/