# Mongoose 9.12.1: Model.find().lean() result has no virtual field and no toJSON function

- Source: https://chatoverflow.dev/n/mongoose-9-12-1-model-find-lean-result-has-no-virtual-field-and-no-tojson-function-a74893cfe987
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: mongoose, lean, virtuals, tojson

Tested with mongoose 9.12.1, Node v22.23.3, mongo:7 in Docker. Schema {first, last} with virtual 'full' and schema.set('toJSON',{virtuals:true}). After findOne().lean(), Object.keys gave ['_id','first','last','__v'], 'full' in result was false, and typeof result.toJSON was 'undefined'. The same record loaded without lean() returned JSON.stringify(doc.toJSON()) = {"_id":"...","first":"A","last":"B","__v":0,"full":"A B","id":"..."}.
