{"id":42749,"library":"feathers-mongodb-management-ts","title":"feathers-mongodb-management-ts","description":"MongoDB management helpers for Feathers v5 (Koa) applications, written in TypeScript. Version 2.3.2 provides utilities for database administration tasks such as creating indexes, managing collections, and running migrations against a MongoDB instance via Feathers services. It leverages the official MongoDB Node.js driver and Feathers' hook and service patterns. Released regularly, it is designed specifically for Feathers v5 and TypeScript users, offering type-safe methods compared to generic MongoDB management scripts. Key differentiators: tight integration with Feathers 5's dependency injection and hooks, full TypeScript support, and focus on common admin operations.","status":"active","version":"2.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/vevedh/feathers-mongodb-management-ts","tags":["javascript","feathers","feathersjs","feathers-v5","mongodb","typescript","admin","management"],"install":[{"cmd":"npm install feathers-mongodb-management-ts","lang":"bash","label":"npm"},{"cmd":"yarn add feathers-mongodb-management-ts","lang":"bash","label":"yarn"},{"cmd":"pnpm add feathers-mongodb-management-ts","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: required for Feathers application and service interfaces","package":"@feathersjs/feathers","optional":true}],"imports":[{"note":"ESM default since v2. Use named import; CJS require must use .default or destructure.","wrong":"const ManagementService = require('feathers-mongodb-management-ts').ManagementService","symbol":"ManagementService","correct":"import { ManagementService } from 'feathers-mongodb-management-ts'"},{"note":"Function is exported as a named export, not default. Wrong import yields undefined.","wrong":"import createIndexes from 'feathers-mongodb-management-ts'","symbol":"createIndexes","correct":"import { createIndexes } from 'feathers-mongodb-management-ts'"},{"note":"ManagementType is a TypeScript type, should be imported with `type` to avoid runtime errors in TS.","wrong":"import { ManagementType } from 'feathers-mongodb-management-ts'","symbol":"ManagementType","correct":"import type { ManagementType } from 'feathers-mongodb-management-ts'"}],"quickstart":{"code":"import { feathers } from '@feathersjs/feathers';\nimport { ManagementService, createIndexes } from 'feathers-mongodb-management-ts';\n\nconst app = feathers();\n\n// Register the management service\napp.use('management', new ManagementService({ db: 'mongodb://localhost:27017/myapp' }));\n\n// Create indexes for a collection\nconst indexes = [\n  { key: { email: 1 }, unique: true },\n  { key: { createdAt: -1 }, background: true }\n];\n\nasync function run() {\n  const service = app.service('management');\n  await createIndexes(service, 'users', indexes);\n  console.log('Indexes created');\n}\n\nrun().catch(console.error);","lang":"typescript","description":"Registers the ManagementService and uses createIndexes to add indexes to the 'users' collection. Assumes a Feathers v5 app with MongoDB connection."},"warnings":[{"fix":"Update to `new ManagementService({ db: connectionString })` and pass any additional options like `options`.","message":"ManagementService constructor now requires options object with `db` property; previous versions accepted a connection string directly.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Use ES import syntax or `const pkg = require('feathers-mongodb-management-ts').default`.","message":"All functions are now ESM-only; CommonJS `require` still works via `.default` but will be removed in v3.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use `app.service('management').remove('collectionName')` instead of `dropCollection(service, 'collectionName')`.","message":"`dropCollection` method is deprecated in favor of `removeService` service method.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure your connection is established before calling any management methods, or pass a connected `MongoClient` instance via `{ client }`.","message":"The package does not handle MongoDB connection lifecycle; you must provide a connected client or connection string to the constructor. Reconnection logic is not included.","severity":"gotcha","affected_versions":"*"},{"fix":"Remove `background: true` for MongoDB >=4.2 or rely on the driver's default behavior.","message":"Index creation in the background (`background: true`) is ignored in MongoDB versions 4.2+. The option is silently ignored but still accepted.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'2.3.2':18 '5':83 'admin':96,106 'administr':23 'applic':13 'collect':30 'common':95 'compar':71 'creat':27 'databas':22 'depend':85 'design':58 'differenti':78 'driver':47 'feather':2,10,39,49,61,82,99,102 'feathers-mongodb-management-t':1 'feathers-v5':101 'feathersj':100 'focus':93 'full':89 'generic':73 'helper':8 'hook':50,88 'index':28 'inject':86 'instanc':37 'integr':80 'javascript':98 'key':77 'koa':12 'leverag':42 'manag':4,7,29,75,107 'method':70 'migrat':33 'mongodb':3,6,36,45,74,104 'node.js':46 'offer':66 'offici':44 'oper':97 'pattern':53 'provid':19 'regular':55 'releas':54 'run':32 'safe':69 'script':76 'servic':40,52 'specif':59 'support':91 'task':24 'tight':79 'ts':5 'type':68 'type-saf':67 'typescript':16,64,90,105 'user':65 'util':20 'v5':11,62,103 'version':17 'via':38 'written':14","created_at":"2026-06-05T16:56:28.743082+00:00","updated_at":"2026-06-05T16:56:28.743082+00:00","problems":[{"fix":"Use `import { createIndexes } from 'feathers-mongodb-management-ts'`.","cause":"Wrong import syntax; using default import instead of named import.","error":"TypeError: (0 , feathers_mongodb_management_ts.createIndexes) is not a function"},{"fix":"Pass an object with `db` key: `new ManagementService({ db: 'mongodb://...' })`.","cause":"ManagementService constructor called without `db` property (e.g., `new ManagementService('str')` instead of `new ManagementService({ db: 'str' })`).","error":"Error: Invalid schema, expected `db` to be a string or an object"},{"fix":"Use `import type { ManagementType } from '...'` and ensure it's used as a type only.","cause":"Importing ManagementType without specifying `type` keyword in TypeScript, or it's used in value position.","error":"Cannot find name 'ManagementType'. Did you mean 'ManagementService'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/vevedh/feathers-mongodb-management-ts#readme","github":"https://github.com/vevedh/feathers-mongodb-management-ts","docs":null,"changelog":null,"pypi":null,"npm":"feathers-mongodb-management-ts","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}