Want to reuse part of a Mongoose schema in another schema?
Use `Schema.prototype.pick()`
Just make sure to also `excludeIndexes` to avoid unnecessary index builds!
Learn more 👉 mongoosejs.com/docs/api/sche…#NodeJS#MongoDB#JavaScript
Mongoose 6.8.4 released
🛠️ Handle creating model when connection disconnected with bufferCommands = false
🛠️ Merge instead of overwrite when match is on _id
github.com/Automattic/mongoo…#NodeJS#MongoDB
Mongoose 6.8.4 released
🛠️ Handle creating model when connection disconnected with bufferCommands = false
🛠️ Merge instead of overwrite when match is on _id
github.com/Automattic/mongoo…#NodeJS#MongoDB
Mongoose getters don't allow passing parameters the conventional way, because you don't call getters as a function
But you can configure your getters using Mongoose documents' `$locals` property
Learn more 👉 mongoosejs.com/docs/tutorial…#NodeJS#MongoDB
By default, Mongoose doesn't let you update a document's discriminator key
However, queries have an `overwriteDiscriminatorKey` option that you can set to allow changing the discriminator key
Learn more 👉 mongoosejs.com/docs/discrimi…#NodeJS#MongoDB
Mongoose 6.8.3 released
🏎️ Improve performance of assignRawDocsToIdStructure for faster populate on large docs
🛠️ Ensure consistent ordering of validation errors in insertMany()
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
You can call `Model.create()` with options, like a session for transactions
But to do that, you _must_ pass an array as the first arg
Learn more 👉 mongoosejs.com/docs/api/mode…#NodeJS#MongoDB
Mongoose 6.8.3 released
🏎️ Improve performance of assignRawDocsToIdStructure for faster populate on large docs
🛠️ Ensure consistent ordering of validation errors in insertMany()
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Pro tip: avoid connecting to MongoDB in your serverless function until _after_ you've validated the input
Save yourself an unnecessary connection
More about Mongoose and Lambda 👉 mongoosejs.com/docs/lambda.h…#JavaScript#CodeNewbie
Mongoose 6.8.1 released:
🛠️ Avoid throwing circular dependency error if same object is used in multiple properties
🛠️ Return value from super.delete() in Map
Full changelog: github.com/Automattic/mongoo…#NodeJS#JavaScript#MongoDB
Mongoose 6.8.1 released:
🛠️ Avoid throwing circular dependency error if same object is used in multiple properties
🛠️ Return value from super.delete() in Map
Full changelog: github.com/Automattic/mongoo…#NodeJS#JavaScript#MongoDB