Mongoose 6.6.3 released:
🛠️ Treat findOne(_id) as equivalent to findOne({ _id })
🛠️ findOneAndUpdate creates subdocs with timestamps in reverse order
Full changelog: github.com/Automattic/mongoo…#NodeJS#MongoDB#JavaScript
Mongoose populate virtuals support numerous handy options, like `match` to add additional filters and `justOne` to switch whether the result is an array or a document.
You can use `match` to further restrict output to at most 1 doc and set `justOne` 😎
#NodeJS#MongoDB
Got a document that you don't want to ever show up in the frontend?
You can create a custom `toJSON()` method on your schema, which determines how that document gets serialized to JSON.
#NodeJS#MongoDB