0.9.1 • Published 2 years ago
mongoose-lean-virtuals v0.9.1
mongoose-lean-virtuals
Attach virtuals to the results of mongoose queries when using .lean()
.
Usage
const mongooseLeanVirtuals = require('mongoose-lean-virtuals');
// Example schema
const userSchema = new mongoose.Schema({ name: String });
userSchema.virtual('lowercase').get(function() {
return this.name.toLowerCase();
});
// Now, the `lowercase` property will show up even if you do a lean query
userSchema.plugin(mongooseLeanVirtuals);
// Later
// You **must** pass `virtuals: true` to `lean()`, otherwise `lowercase`
// won't be in `res`
const res = await UserModel.find().lean({ virtuals: true });
0.9.1
2 years ago
0.9.0
3 years ago
0.8.1
3 years ago
0.8.0
3 years ago
0.7.6
4 years ago
0.7.5
4 years ago
0.7.4
4 years ago
0.7.3
4 years ago
0.7.2
4 years ago
0.7.1
4 years ago
0.7.0
4 years ago
0.6.9
4 years ago
0.6.8
4 years ago
0.6.7
4 years ago
0.6.6
4 years ago
0.6.5
4 years ago
0.6.4
4 years ago
0.6.3
4 years ago
0.6.2
4 years ago
0.6.1
5 years ago
0.6.0
5 years ago
0.5.0
5 years ago
0.4.4
5 years ago
0.4.3
5 years ago
0.4.2
5 years ago
0.4.1
5 years ago
0.4.0
5 years ago
0.3.5
6 years ago
0.3.4
6 years ago
0.3.3
6 years ago
0.3.2
6 years ago
0.3.1
6 years ago
0.3.0
7 years ago
0.2.0
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago