@chevre/domain 23.2.0-alpha.31 → 23.2.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/chevre/repo/event.js
CHANGED
|
@@ -344,15 +344,27 @@ class EventRepo {
|
|
|
344
344
|
}
|
|
345
345
|
if (bulkWriteOps.length > 0) {
|
|
346
346
|
const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
347
|
+
// update:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-16~)
|
|
348
|
+
if (!update) {
|
|
349
|
+
// BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
|
|
350
|
+
return {
|
|
351
|
+
bulkWriteResult,
|
|
352
|
+
modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
|
|
353
|
+
.map((id) => ({ id: String(id) }))
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
358
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
|
|
359
|
+
_id: 0,
|
|
360
|
+
id: { $toString: '$_id' }
|
|
361
|
+
})
|
|
362
|
+
.lean()
|
|
363
|
+
.exec();
|
|
364
|
+
return { bulkWriteResult, modifiedEvents };
|
|
365
|
+
}
|
|
355
366
|
}
|
|
367
|
+
return { modifiedEvents: [] };
|
|
356
368
|
});
|
|
357
369
|
}
|
|
358
370
|
/**
|
package/package.json
CHANGED