我想知道如何使用自己的预定义_id值向Mongo集合"根级文档"插入对象数组.
我试过db.MyCollection.insert(array);但它在MongoDB中的一个单独生成的_id下创建了嵌套文档.
var array = [
{ _id: 'rg8nsoqsxhpNYho2N',
goals: 0,
assists: 1,
total: 1 },
{ _id: 'yKMx6sHQboL5m8Lqx',
goals: 0,
assists: 1,
total: 1 }];
Run Code Online (Sandbox Code Playgroud)
db.MyCollection.insert(数组);
我想要的是