diff --git a/packages/mongodb/src/adapter.ts b/packages/mongodb/src/adapter.ts index d653de0969..b41c5125ba 100644 --- a/packages/mongodb/src/adapter.ts +++ b/packages/mongodb/src/adapter.ts @@ -281,7 +281,9 @@ export class MongoDbAdapter< ? model .insertMany(data.map(setId), writeOptions) .then(async (result) => - model.find({ _id: { $in: Object.values(result.insertedIds) } }, params.mongodb).toArray() + Promise.all( + Object.values(result.insertedIds).map(async (_id) => model.findOne({ _id }, params.mongodb)) + ) ) : model .insertOne(setId(data), writeOptions)