We make heavy use of Mongoose virtuals to minimize frontend logic
Write one Mongoose virtual, means all clients can reuse the same logic, even if iOS or Kotlin
#NodeJS
Mongoose 8.2.2 released
🛠️ Improve update minimizing to only minimize top-level properties in the update
🛠️ Add Null check in case schema.options['type'][0] is undefined
github.com/Automattic/mongoo…#NodeJS#JavaScript#MongoDB
Mongoose 7.6.9 released:
🛠️ Handle embedded recursive discriminators on nested path defined using Schema.prototype.discriminator
🛠️ Correct return type for findByIdAndDelete()
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Mongoose 8.2.0 released
⭐ Add recompileSchema() function to models to allow applying schema changes after compiling
⭐ Add middleware for bulkWrite() and createCollection()
github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Mongoose 8.1.2 released
🛠️ Include virtuals in document array toString() output if toObject.virtuals set
🛠️ Handle setting nested path to spread doc with extra properties
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Mongoose 8.1.1 released:
🛠️ Throw readable error when calling Model() with a string instead of model()
🛠️ Add back context and setDefaultsOnInsert as Mongoose-specific query options
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Virtuals are a great tool for convenience wrappers around complex properties
Here's a virtual for sales tax in an ecom application. The sales tax is stored in `lineItems` array, but the `salesTax` virtual lets you read/write as if it were a property
#JavaScript#CodeNewbie