A data model for MongoDB collection metadata used in the MongoDB Compass ecosystem. Version 5.35.0 provides TypeScript types and supports both ESM and CJS. It models collection properties like indexes, document count, storage size, and validation schema, and is primarily used to represent collection information retrieved from MongoDB servers. Released as part of the mongodb-js Compass packages, it follows the Compass release cadence. Unlike the MongoDB Node.js driver's collection object, this library focuses on serializable metadata with helper methods for UI display.
npm install mongodb-collection-modelNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a collection model instance from metadata, showing property access.
Update calls to 'new CollectionModel(data)' without options parameter.
Always provide complete metadata object as documented.
Use 'model.isRunning' and 'model.isPaused' methods.
When setting indexes, provide IndexModel instances or use the helper method 'createIndex'.
Use 'const CollectionModel = require('mongodb-collection-model');' (no .default).Run 'npm install mongodb-collection-model' and ensure import path is correct.
Upgrade to v5.0.0 or later, which includes TypeScript types.