mongoose-lean-getters
Usage
const mongoose = require('mongoose');
const mongooseLeanGetters = require('mongoose-lean-getters');
const schema = mongoose.Schema({
name: {
type: String,
get: v => v.slice(-6)
}
});
schema.plugin(mongooseLeanGetters);
await Model.create({ name: 'Captain Jean-Luc Picard' });
const doc = await Model.findOne().lean({ getters: true });
doc.name;
Changelog
0.2.0 / 2021-03-03
- feat: add index.d.ts for TypeScript support #4
0.1.2 / 2019-12-05
- fix: only call getters once when using
find()
#1
0.1.1 / 2019-07-18
- docs: add example to README