Skip to content

Release 12.0.0

Latest

Choose a tag to compare

@kamilmysliwiec kamilmysliwiec released this 27 Aug 08:31
4b05bb3

What's Changed

@nestjs/mongoose is now a native ES module, and the major version is aligned with the Nest 12 release line.

ESM migration

The package is published as pure ESM ("type": "module", compiled with NodeNext) behind a proper exports map. Deep imports into build internals (@nestjs/mongoose/dist/...) are no longer resolvable — import from the package root:

import { InjectModel, MongooseModule, Prop, Schema, SchemaFactory } from '@nestjs/mongoose';

require(esm) — CommonJS still works

You do not need to convert your app to ESM. Thanks to Node's require(esm) support, the package resolves through the default export condition and can be loaded from CommonJS as-is:

const { MongooseModule } = require('@nestjs/mongoose');

This requires Node.js 20.19+ or 22.12+ (where require(esm) is enabled by default). On older Node versions you'll need to load the package with a dynamic import().