在MongoDB权威指南中,批量输入文档的命令为db.things.batchInsert()。
经测试,该命令有误,经查询db.things.help(),发现命令为db.things.insertMany().
实际的例子:
db.things.insertMany([{"_id":0},{"_id":1},{"_id":2}])
本文纠正了MongoDB权威指南中的一个错误,实际批量插入文档的命令并非db.things.batchInsert(),而是db.things.insertMany()。并给出了具体的使用示例。
在MongoDB权威指南中,批量输入文档的命令为db.things.batchInsert()。
经测试,该命令有误,经查询db.things.help(),发现命令为db.things.insertMany().
实际的例子:
db.things.insertMany([{"_id":0},{"_id":1},{"_id":2}])
1719
6589
8331

被折叠的 条评论
为什么被折叠?
