database-connector 2.4.10 → 2.4.11

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.
@@ -428,9 +428,12 @@ const subscriptionSchema = new mongoose.Schema(
428
428
  );
429
429
 
430
430
  // Auto-record history snapshots to embedded subscriptionsHistory array
431
- subscriptionSchema.post('save', async function (doc) {
432
- if (this.getOptions && this.getOptions().skipHistory) return;
431
+ subscriptionSchema.post('save', async function (doc, next) {
432
+ // For save operations, check the $locals property where custom options are stored
433
+ if (doc.$locals && doc.$locals.skipHistory) return next();
434
+ if (this.$locals && this.$locals.skipHistory) return next();
433
435
  await recordSubscriptionHistory(doc);
436
+ next();
434
437
  });
435
438
 
436
439
  subscriptionSchema.post('findOneAndUpdate', async function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.4.10",
3
+ "version": "2.4.11",
4
4
  "description": "MongoDB models package with Mongoose schemas for e-commerce applications. Includes User, Product, Store, Order and more with built-in validation and virtual properties.",
5
5
  "main": "models/index.js",
6
6
  "scripts": {