【发布时间】:2022-10-21 05:18:46
【问题描述】:
我有一长串要创建的文档。当我创建它们时,我没有收到任何错误。
const docsJson =[some array of json of docs to create]
const orders = await MySchema.create(ordersJSON);
// orders.length returns the same number of docs as docsJson
但是当我搜索新文档时,只创建了一些。
const actualOrdersCreated = await MySchema.find({ _id: { $in: orders.map((p) => p._id) } });
// actualOrdersCreated.length returns less docs than in docsJson
这是什么原因造成的?
【问题讨论】:
标签: javascript mongodb mongoose mongodb-query