diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 9673733113..d3dbc9d6aa 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1421,6 +1421,8 @@ declare module "mongoose" { isNew: boolean; /** The documents schema. */ schema: Schema; + /** Empty object that you can use for storing properties on the document */ + $locals: { [k: string]: any }; } interface MongooseDocumentOptionals { diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index a0b3102b6d..397ef94490 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -732,6 +732,7 @@ mongoose.plugin(AwesomeLoggerPlugin, {modelName: 'Executive', time */ var doc = {}; doc.$isDefault('path').valueOf(); +doc.$locals.field = 'value'; const docDotDepopulate: mongoose.MongooseDocument = doc.depopulate('path'); doc.equals(doc).valueOf(); doc.execPopulate().then(function (arg) {