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
Mongoose 8.0.4 released; it's a big one, with 5 bug fixes and 4 typescript improvements
🛠️ Set CastError path to full path if casting update fails
🛠️ Allow defining index on base model that applies to all discriminators
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB
Mongoose 8.0.3 released:
🛠️ Avoid creating unnecessary clone of schematype in nested array so nested document arrays use correct constructor
📖 Add example of registering connection event handlers
github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript